-
Notifications
You must be signed in to change notification settings - Fork 645
feat(ec2-metadata-service): add retries for IMDS requests #7569
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
base: main
Are you sure you want to change the base?
Conversation
f4d18da to
c9e9d32
Compare
c9e9d32 to
87890fc
Compare
| */ | ||
| retries?: number; | ||
| /** | ||
| * the number of seconds to sleep in-between retries and/or a customer provided backoff function to call. |
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.
docs should say:
If the function returns a promise, it will be awaited and its resolved value ignored.
If the function returns a number, the number will be used as a millisecond duration to wait before the following retry attempt.
| await this.backoffFn(attempt); | ||
| const backoffResult = this.backoffFn(attempt); | ||
| if (typeof backoffResult === "number") { | ||
| await this.sleep(backoffResult * 1000); // seconds to milliseconds |
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.
use milliseconds for time, since that is the time unit idiomatic to the language? how is the specification on this?
Issue
Internal JS-5193
Description
Support retries for EC2 IMDS requests and fetching tokens.
Testing
Unit tests:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.