fix credentials concurrent promise bug (by devin)

This commit is contained in:
Mikael Finstad 2026-04-09 20:49:34 +02:00
parent 260409a1ac
commit 260409902e
No known key found for this signature in database
GPG key ID: 25AB36E3E81CBC26

View file

@ -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