-
Notifications
You must be signed in to change notification settings - Fork 578
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(middleware-signing): memoize temporary credentials #2109
Conversation
if (typeof credentials === "function") { | ||
return memoize( | ||
credentials, | ||
(credentials) => credentials.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000, |
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.
can we pull this magic number into a named const?
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.
Nits, lgtm
5196f40
to
177c709
Compare
Codecov Report
@@ Coverage Diff @@
## main #2109 +/- ##
=======================================
Coverage ? 78.68%
=======================================
Files ? 380
Lines ? 16080
Branches ? 3444
=======================================
Hits ? 12653
Misses ? 3427
Partials ? 0 Continue to review full report at Codecov.
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Issue
Resolves #2107
Description
It turns out not difficult to fix. When resolving the credentails in the
resolveAwsAuthConfig()
, if the user supplies a customer credential provider, the client will memoize the resolved value. If the resolved value is expired, the credential will be reloaded. If the credential provider only returns a static credential(never expires), the credential will keep memoized.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.