transaction debug logs for transaction time#307
Conversation
WalkthroughPerformance timing measurements were added to the asynchronous Changes
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
241-250: Performance timing logging is correctly implemented.
The code capturesstartTimebeforesend(), computeselapsedMsafter, and logs it viatransactionDebugLog, which aligns with the PR’s goal. To make this more robust and DRY:
- Use a
try…finallyto guarantee logging even ifsend()throws.- Extract the timing pattern into a shared helper or custom hook since it’s duplicated in both Tokens and Batches views.
Proposed refactor:
- transactionDebugLog('Preparing to send transaction'); - const startTime = performance.now(); - const sent = await send(); - const endTime = performance.now(); - const elapsedMs = endTime - startTime; - transactionDebugLog(`Time taken to send transaction (ms): ${elapsedMs.toFixed(2)}`); + transactionDebugLog('Preparing to send transaction'); + const startTime = performance.now(); + let sent; + try { + sent = await send(); + } finally { + const endTime = performance.now(); + const elapsedMs = endTime - startTime; + transactionDebugLog(`Time taken to send transaction (ms): ${elapsedMs.toFixed(2)}`); + }src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (1)
105-114: Batch send timing instrumentation added correctly.
This mirrors the Tokens view: it recordsstartTime/endTimearoundsend([batchId])and logs the elapsed duration. To enhance reliability and reduce duplication:
- Wrap the
send()call in atry…finallyso timing is logged even on errors.- Move the timing logic into a shared utility or custom hook to keep both files DRY.
Suggested patch:
- transactionDebugLog('Preparing to send batch:', batchId); - const startTime = performance.now(); - const sent = await send([batchId]); - const endTime = performance.now(); - const elapsedMs = endTime - startTime; - transactionDebugLog(`Time taken to send batch (ms): ${elapsedMs.toFixed(2)}`); + transactionDebugLog('Preparing to send batch:', batchId); + const startTime = performance.now(); + let sent; + try { + sent = await send([batchId]); + } finally { + const endTime = performance.now(); + const elapsedMs = endTime - startTime; + transactionDebugLog(`Time taken to send batch (ms): ${elapsedMs.toFixed(2)}`); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx(1 hunks)src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: lint
- GitHub Check: unit-tests
- GitHub Check: build
- GitHub Check: Cloudflare Pages
Deploying x with
|
| Latest commit: |
9d1ecd1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://41af65b9.x-e62.pages.dev |
| Branch Preview URL: | https://fix-pro-3323-logging-send-fl.x-e62.pages.dev |
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit