-
Notifications
You must be signed in to change notification settings - Fork 1
Dev #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #428
Conversation
Fixes faucet.InvalidWorkBlock error caused by premature unsubscription from new block updates. Refactors code following best practices including fail-fast pattern, early returns, immutability, and proper error handling. Key Changes: - Fix: Moved unsubscribe from finally block to onFound/onError callbacks - Fix: Use tryAsync for async operations (queryLastBlock, subscribeNewHeads) - Feature: Automatic retry (up to 3 attempts) for InvalidWorkBlock errors - Feature: Custom InvalidWorkBlockError class for recoverable errors - Refactor: Extract pure functions (handleModuleError, handleDispatchError, etc) - Refactor: Add readonly properties to MultiWorkerManager - Refactor: Replace non-null assertions with optional chaining - Refactor: Add Working/Requesting status messages - Refactor: Remove emojis from console output - Refactor: Add BlockData and WorkerMessageData interfaces - Refactor: Extract constants (MAX_RETRIES, FAUCET_AMOUNT, DEFAULT_WORKER_COUNT) User Experience: - Silent retry on InvalidWorkBlock with console.log (no error toast) - Clear status progression: "Working..." -> "Requesting..." - Error toast only shown after 3 failed retry attempts - Improved error messages without emojis Technical Improvements: - Early return pattern throughout - No nested if-else statements - Fail-fast error handling - Immutable data structures where possible - Type-safe error handling with custom error classes - Proper cleanup of subscriptions and workers Generated with Claude Code https://claude.com/claude-code Co-Authored-By: Claude <noreply@anthropic.com>
…ssues - Add error message display when all retry attempts fail - Terminate workers immediately on error to prevent resource leaks - Change event loop to for...of with break to prevent duplicate handler calls - Ensure manager.terminateAll() is called during cleanup - Call unsubscribe() when extrinsic transaction fails These fixes address all code review comments and prevent resource leaks in the faucet worker management and subscription systems.
…anager - Import assert from tsafe following project conventions - Add assertion to ensure manager is defined in subscription callback - This guarantees manager safety without non-null assertion operator (!)
…nd error handling - Add API null check guard in submit function with user-facing error message - Wrap call.send() with tryAsync to handle send errors properly - Declare unsubscribe before send call and assign after await - Add assert guards to ensure unsubscribe is defined in callbacks - Prevents hanging promises when send() fails and ensures proper cleanup Addresses CodeRabbit critical issues: - Double cast masking null-safety issue now has explicit guard - Unhandled rejection from call.send() now properly caught and rejected
- Change unsubscribe from 'let' to 'const' in tryAsync destructuring - Simplifies code and follows prefer-const ESLint rule - unsubscribe is assigned once from tryAsync result
…s for better z-index handling
…ation" with "coordination" in descriptions
Refactor/unused dependency
…ling better scheduling
…api/return-only-reply-chain
…ply-chain fix(pred-api): only return reply chain context
fix(torus-wallet): fixes faucet.InvalidWorkBlock error (web-331)
filter using rest server
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
No description provided.