Add retries to GitHub land API call #168
Open
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.
In Cord we notice that when working on a stack of diffs, then
sometimes
spr land
fails with the following error:This problem goes away if we go to the PR and manually change the PR's
base branch to master. Then
spr land
works fine. This is surprisingbecause in the PR history I can see that spr changed the base branch to
master too when we tried to
spr land
the first time.I initially added a 5s sleep call, and the problem went away. Hence, I
suspect this is an issue on GitHub's end. Hence, I added a retry
mechanism around the API call.
I added a utility function
do_with_retry()
to do this. Not as much forcode re-use, but because it makes the code easier to read IMO. There is
code above my changes that also uses retries, but I did not refactor it
to use
do_with_retry()
because that code looked more complex πTest Plan: I will be using spr with this change for the next few days