feat: Add background retry for pending claim disbursements#523
Open
Menjay7 wants to merge 2 commits into
Open
Conversation
- Add 'disbursing' status to ClaimStatus enum - Modify disburse method to enqueue background jobs with BullMQ - Add ClaimRetryService to monitor and handle stuck disbursements - Update on-chain processor to transition claim status on success/failure - Add automatic retry with exponential backoff (5 attempts) - Add monitoring cron job running every 5 minutes - Revert claims to 'approved' after max retry attempts
- Add @ratelimit decorator for endpoint-specific configuration - Create CostAwareRateLimitGuard with cost-aware rate limiting - Implement automatic cost calculation based on HTTP method and path - Add rate limit headers (Limit, Remaining, Reset, Cost, Window) - Apply rate limits to claims endpoints (create, disburse) - Apply rate limits to verification endpoint (enqueue) - Add comprehensive documentation Default costs: - Read operations: 1 - Write operations: 5 - Expensive operations (on-chain): 20 - Bulk operations: 50
Contributor
|
Please fix the workflow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
Overview
This PR introduces a background retry mechanism for pending claim submissions to improve reliability and ensure failed or delayed claim operations are retried automatically.
Problem
Pending claim submissions could remain unresolved due to:
temporary network failures
downstream service interruptions
timeout issues
intermittent processing errors
Without an automated retry mechanism, these claims required manual intervention or risked remaining permanently unprocessed.
Changes Made
Added background worker/process for retrying pending claim submissions
Implemented retry scheduling and status tracking logic
Added configurable retry intervals and retry limits
Improved handling of transient submission failures
Added safeguards to prevent duplicate processing
Refactored claim state transitions for more reliable recovery behavior
Benefits
Improves reliability of claim processing workflows
Reduces manual operational intervention
Prevents claims from becoming permanently stuck
Enhances resilience against temporary infrastructure failures
Improves overall user experience and submission consistency
Testing
Verified failed claims are retried automatically
Tested retry backoff and retry limit behavior
Confirmed successful claims are not retried unnecessarily
Validated duplicate processing protections
Ensured no regression in existing claim submission flows...Closed #451