-
Notifications
You must be signed in to change notification settings - Fork 139
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
Issue #28: Increase sleep timeout to prevent api rate limiting #29
Conversation
Let's take advantage to the fact that we pass this value.
|
@seebees Made a few updates. The basic idea is: make the API call, check if we errored, and if we did, check that it's a rate limiting error. If so, sleep for a bit and try again (after extending the sleep timer). If not, throw an error (because it's a genuine error from the AWS API and as such, the job should fail). |
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.
Need tests :)
But the basic idea looks good.
Thanks.
@seebees added tests to check for rate limiting retry logic and also to make sure it properly dies if it gets a different error from the AWS API |
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.
This is looking great!
|
||
const sdk = help( | ||
() => { | ||
//similar to the ret function in the helper, allows me to throw an error in a function or return a more standard reply |
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.
Take a look at: https://sembr.org/
You might like it.
It makes the diff of comments much nicer
and easier to read in diff tools.
test/code-build-test.js
Outdated
@@ -318,6 +318,104 @@ describe("waitForBuildEndTime", () => { | |||
}); | |||
expect(test).to.equal(buildReplies.pop().builds[0]); | |||
}); | |||
|
|||
it("waits after being rate limited and tries again", async function() { | |||
this.timeout(45000); |
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 below, this can be dropped for both tests :)
]; | ||
|
||
const sdk = help( | ||
() => { |
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'm going to say leave it now,
but maybe this functionality should be pulled into the root help
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.
Looks good,
thanks!
Issue #, if available: #28
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.