-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix: apply fibonacci backoff delay and threshold #663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR! I've left some comments to review
src/modules/transaction/sagas.ts
Outdated
prev = current | ||
current = next | ||
} | ||
return current * INITIAL_BACKOFF_DELAY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we multiply the Fibonacci number with the initial backoff, we'll get double the Fibonacci number. If we want to start with a 2 seconds delay, we could start at the attempt number 2, what do you think about it?
Here we can just multiply the current Fibonacci value by 1000 to have seconds.
return current * INITIAL_BACKOFF_DELAY | |
return current * 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of that variable was to be able to configure the speed while keeping the fibonacci exponential curve. I changed the name to be more accurate BACKOFF_DELAY_MULTIPLIER
and made it faster so it follows the fibonacci sequence instead of the double of the curve.
2a56bec
to
eaf8a84
Compare
🎉 This PR is included in version 23.23.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR implements a fibonacci backoff strategy for transaction polling. The changes improve the reliability of transaction status monitoring while reducing unnecessary network calls.
Core Changes (478aeda)
DROPPED_TRANSACTION_THRESHOLD
constant (24 hours)TRANSACTION_FETCH_DELAY
toINITIAL_BACKOFF_DELAY
Test Suite Changes (c12b2df)
Technical Details
The fibonacci backoff strategy increases the delay between polling attempts using the fibonacci sequence, starting with an initial delay of 2 seconds. This helps reduce network load while maintaining responsiveness for transaction status updates.