-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: add exponential retries on merge errors #480
feat: add exponential retries on merge errors #480
Conversation
Pull Request Test Coverage Report for Build 194556948
💛 - Coveralls |
Why is the |
16c3132
to
9289fbb
Compare
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.
Looks good the only thing I am missing is the README changes, there we can describe how to configure the number of retires.
|
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.
See comment
…n `merge` function
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.
Only some errors should be retried, I don't think we should retry in all cases. As an example, the "out of sync" error is not retriable, as the branch must be rebased. Some other errors, such as the one originally reported, are cause by GitHub not being done processing yet. This should be retried.
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.
One small comment. This is indeed better with .times(3)
. Also see Natan's review.
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.
Also we should overwrite Date.now or something similar to speed up the tests. We should never actually be backing off that long during the test.
…dedott/merge-me-action into feat/CP-2089_retry_PR_on_merge_errors
Added parameter to speed up tests: ef0cedc Retrying only on the reported error: 7cf6771 ( appreciate feedback on this one) |
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.
@ricardoatsouza can you please revert #ef0cedc3674f849c0f0120c0d0d990d2f28537f1. You are exposing an internal implementation by changing the interface, but the option is never used in production. Also starting the backoff from 100ms instead is definitelly not the correct way to "speed up the test". Any timers that run longer than the an immediate interval should be avoided as much as possible. See our (internal) firestore-extensions package (retries.spec.ts) on how to properly test it.
Can you add a test that makes sure backoff does not happen if shouldRetry does not match the error?
It's not the wrong way either. Regardless:
Added in d5400ab |
This Pull Request fulfills the following requirements:
Resolves
Add an exponential retry on merge error, basically retrying up to three times (1 second after the first failure, then 4 seconds later and, finally, again 9 seconds later). If all three fail, an error is thrown.