mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
fix credentials concurrent promise bug (by devin)
This commit is contained in:
parent
260409a1ac
commit
260409902e
1 changed files with 10 additions and 8 deletions
|
|
@ -117,14 +117,16 @@ class S3mini extends S3Client {
|
|||
|
||||
// Cache the promise so concurrent calls wait for the same fetch
|
||||
if (this.cachedCredentialsPromise == null) {
|
||||
try {
|
||||
const creds = await this.getCredentials!({})
|
||||
this.cachedCredentials = creds
|
||||
return creds
|
||||
} finally {
|
||||
// Clear promise cache after resolution to allow future retries
|
||||
this.cachedCredentialsPromise = undefined
|
||||
}
|
||||
this.cachedCredentialsPromise = (async () => {
|
||||
try {
|
||||
const creds = await this.getCredentials!({})
|
||||
this.cachedCredentials = creds
|
||||
return creds
|
||||
} finally {
|
||||
// Clear promise cache after resolution to allow future retries
|
||||
this.cachedCredentialsPromise = undefined
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
return this.cachedCredentialsPromise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue