mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #28543 from overleaf/msm-disable-retries-s3
[object-persistor] fix disable retries on PutObjectCommand GitOrigin-RevId: 7a812385e70781939f21325572c0eedb856e734f
This commit is contained in:
@@ -631,10 +631,14 @@ class S3Persistor extends AbstractPersistor {
|
|||||||
|
|
||||||
// maxRetries has been moved to maxAttempts in aws-sdk v3,
|
// maxRetries has been moved to maxAttempts in aws-sdk v3,
|
||||||
// we're keeping the existing setting for backwards compatibility
|
// we're keeping the existing setting for backwards compatibility
|
||||||
if (!noRetries && this.settings.maxRetries) {
|
if (this.settings.maxRetries) {
|
||||||
options.maxAttempts = this.settings.maxRetries + 1
|
options.maxAttempts = this.settings.maxRetries + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noRetries) {
|
||||||
|
options.maxAttempts = 1
|
||||||
|
}
|
||||||
|
|
||||||
const requestHandlerParams = this.settings.httpOptions || {}
|
const requestHandlerParams = this.settings.httpOptions || {}
|
||||||
|
|
||||||
if (sslEnabled && this.settings.ca) {
|
if (sslEnabled && this.settings.ca) {
|
||||||
|
|||||||
@@ -108,5 +108,11 @@ module.exports = function () {
|
|||||||
this.payload = payload
|
this.payload = payload
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
PutObjectCommand: class PutObjectCommand {
|
||||||
|
constructor(payload) {
|
||||||
|
this.name = 'PutObjectCommand'
|
||||||
|
this.payload = payload
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,10 +594,24 @@ describe('S3PersistorTests', function () {
|
|||||||
partSize: 100 * 1024 * 1024,
|
partSize: 100 * 1024 * 1024,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('when multipart upload is disabled', function () {
|
||||||
|
const contentType = 'text/csv'
|
||||||
|
const contentEncoding = 'gzip'
|
||||||
|
|
||||||
|
beforeEach(async function () {
|
||||||
|
S3.mockSend(S3.PutObjectCommand, {})
|
||||||
|
settings.disableMultiPartUpload = true
|
||||||
|
await S3Persistor.sendStream(bucket, key, ReadStream, {
|
||||||
|
contentType,
|
||||||
|
contentEncoding,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('configures the options to not to retry requests', function () {
|
it('configures the options to not to retry requests', function () {
|
||||||
expect(S3.S3Client).not.to.have.been.calledWithMatch({
|
expect(S3.S3Client).to.have.been.calledWithMatch({
|
||||||
maxAttempts: sinon.match.number,
|
maxAttempts: 1,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user