-
Notifications
You must be signed in to change notification settings - Fork 66
Add real-time RPC failure reporting for explorer auto-deactivation #438
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
Conversation
When blockSync/receiptSync jobs encounter RPC errors, they now immediately report failures to the explorer model. After 3 consecutive failures, the explorer's sync is automatically disabled. Changes: - Add POST /api/explorers/:slug/syncFailure endpoint for PM2 server - Modify blockSync job to report RPC failures directly via model - Modify receiptSync job to report RPC failures directly via model - Add tests for new endpoint (6 test cases) Rate-limited requests are excluded from failure counting since they are expected behavior, not actual RPC failures. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramShows how RPC failures are reported either by the PM2 API endpoint or directly from sync jobs, how the explorer failure counter is incremented, and how explorers are auto-disabled after repeated failures (3 attempts). sequenceDiagram
participant PM2
participant API
participant SyncJob
participant ExplorerModel
PM2->>API: POST /api/explorers/:slug/syncFailure (secret)
API->>ExplorerModel: incrementSyncFailures(reason)
ExplorerModel-->>API: { attempts, disabled }
API-->>PM2: 200 OK (attempts, disabled, message)
SyncJob->>ExplorerModel: incrementSyncFailures('rpc_error') on RPC error
ExplorerModel-->>SyncJob: { attempts, disabled }
alt disabled == true
SyncJob-->>SyncJob: stop sync (shouldSync=false / return)
end
Generated by CodeAnt AI |
Nitpicks 🔍
|
PR Code Suggestions ✨
|
|
CodeAnt AI finished reviewing your PR. |
- Extract duplicate failure reporting logic to run/lib/syncHelpers.js - Exclude timeout errors from failure counting (only actual RPC failures) - Use SYNC_FAILURE_THRESHOLD constant instead of hardcoded value - Add comprehensive unit tests for syncHelpers (7 test cases) Co-Authored-By: Claude Opus 4.5 <[email protected]>
User description
Summary
POST /api/explorers/:slug/syncFailureendpoint protected bysecretMiddlewarefor PM2 server to report RPC failuresblockSyncandreceiptSyncjobs to directly callexplorer.incrementSyncFailures()when RPC errors occurshouldSync=falseandsyncDisabledReason='rpc_error'Test plan
🤖 Generated with Claude Code
CodeAnt-AI Description
Add real-time RPC failure reporting and automatic explorer auto-disable
What Changed
Impact
✅ Automatic explorer sync disable after repeated RPC failures✅ Faster detection of RPC outages for affected explorers✅ Clearer failure reporting for sync processes💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.