Repository navigation
fix: retry note creation when rate limited - #1039
Open
elwynelwyn wants to merge 1 commit into
Open
elwynelwyn wants to merge 1 commit into
elwynelwyn wants to merge 1 commit into
Conversation
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.
Problem this solves
Comments posted by the
successstep are never retried when GitLab rate limits them, so large releases fail with429 Too Many Requestsafter the release has already been published.Our team is experiencing this issue, documented here: https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp/-/work_items/3358
Example failing job:
This is because
got's defaultretry.methodsdoesn't includePOST, so the note creation requests do not ever retry.GitLab.com allows 60 note creations per minute per user, and the plugin posts every comment at once, so any release touching more than ~60 issues/MRs hits it.
The fix
This PR gives the two note
POSTs their own retry config that allowsPOST, but only on429:lib/api/notes.rb), so a 429 is safe to retry and won't duplicate a comment.Retry-After: 60(the full window) with that 429, whichgotalready honours, so the retry lands in a fresh window.The existing
gotretry handling of 429s remains unchanged - it will now also apply it to these requests.Limitations:
retryLimit: 3this covers up to ~240 comments per release on GitLab.com. Bigger releases can raiseretryLimit.Retry-Afterfor this limit, sogotfalls back to its 1s/2s/4s backoff. That's the same failure as today, just ~7s later (self-managed defaults to 300/min, so it's less likely to come up).Related issues
Follow-up to #361 and #728.
How has this been tested?
429withRetry-After, and aren't retried after a500429 ... POST .../noteserror as above