fix: improve backoff retry mechanism#859
Open
erayack wants to merge 3 commits intographprotocol:mainfrom
Open
Conversation
- Refactor BackoffInfo to use remaining() method instead of in_backoff() - Add min_remaining_backoff() method to SenderFeeTracker - Implement dynamic retry scheduling based on backoff state - Remove hardcoded retry_interval from SenderAccountArgs - Add comprehensive unit tests for backoff functionality - Fix syntax error in tracker.rs (missing closing brace) - Improve code formatting and documentation This addresses issues with the retry mechanism by making it more adaptive and removing hardcoded retry intervals in favor of dynamic backoff-based scheduling.
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.
Summary
This PR fixes issue #599 by improving the backoff retry mechanism in the TAP agent. The issue described that when a sender is denied, it aggregates too slowly since RAV requests are only triggered by
UpdateReceiptFeesmessages after a fixedretry_interval(~30 secs), making the aggregation process too slow when the aggregator is UP.Problem
As described in issue #599:
UpdateReceiptFeesmessagesretry_interval(~30 secs)Solution
Use backoff information to retry aggregating instead of a fixed retry_interval (as suggested in the issue):
Backoff System Improvements
BackoffInfo: Replacedin_backoff()withremaining()method for more precise timing controlmin_remaining_backoff(): New method inSenderFeeTrackerto get the minimum remaining backoff across all allocationsschedule_retry()method that considers both global and allocation-specific backoff statesretry_intervalfromSenderAccountArgsin favor of dynamic backoff-based schedulingTesting & Quality
retry_helpers_testsmodule with tests for:BackoffInfo::remaining()reset behavior after successful operationsSenderFeeTracker::min_remaining_backoff()roundtrip functionalitytracker.rsTechnical Details
The retry mechanism now works as follows:
BackoffInfo) and allocation-specific (SenderFeeTracker) backoff states are updatednext_retry_delay()method calculates the maximum of global and allocation-specific remaining backoff timesTesting
The new functionality has been tested with standalone tests that verify:
Files Modified
crates/tap-agent/src/agent/sender_account.rs- Main retry logic improvementscrates/tap-agent/src/agent/sender_accounts_manager.rs- Removed hardcoded retry intervalcrates/tap-agent/src/backoff.rs- Enhanced backoff information trackingcrates/tap-agent/src/test.rs- Added comprehensive unit testscrates/tap-agent/src/tracker.rs- Added min_remaining_backoff method and fixed syntaxFixes
Closes #599