-
Notifications
You must be signed in to change notification settings - Fork 82
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(requests): got calls will be retried on response code 429 #361 #728
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,3 +1,10 @@ | ||||
export const HOME_URL = 'https://github.com/semantic-release/semantic-release'; | ||||
|
||||
export const RELEASE_NAME = 'GitLab release'; | ||||
|
||||
export const RETRY_CONFIGURATION = { | ||||
retry: { | ||||
limit: 3, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default in |
||||
statusCodes: [429], | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can go with the default here:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will close this PR. Thanks for reviewing! |
||||
}, | ||||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -567,7 +567,7 @@ test.serial("Throw error if GitLab API return any other errors", async (t) => { | |
const owner = "test_user"; | ||
const repo = "test_repo"; | ||
const env = { GITLAB_TOKEN: "gitlab_token" }; | ||
const gitlab = authenticate(env).get(`/projects/${owner}%2F${repo}`).times(3).reply(500); | ||
const gitlab = authenticate(env).get(`/projects/${owner}%2F${repo}`).times(3).reply(500).persist(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .persist is needed to avoid confusing nock errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment above |
||
|
||
const error = await t.throwsAsync( | ||
verify({}, { env, options: { repositoryUrl: `https://gitlab.com:${owner}/${repo}.git` }, logger: t.context.logger }) | ||
|
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.
We could try to calculate the
retryAfter
property into optimizing the calculation for the next try.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.
I think
got
does that already, see https://github.com/sindresorhus/got/blob/cc346b79561b13e3a266b22b7f612fca5a45eb1e/source/core/index.ts#L357There 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.
Yes indeed. I assumed we are overriding the
retry
options when setting theapiOptions
. I was wrong. Thanks for properly looking into it. I will close this PR.What is still confusing though are the reported
429
responses of some users...