From 5adfb3e2c09013507079a57ce8c00a10bdf09462 Mon Sep 17 00:00:00 2001 From: Simon Detheridge Date: Fri, 14 Feb 2020 13:29:30 +0000 Subject: [PATCH] Use large upload chunks --- services/filestore/app/js/S3Persistor.js | 2 +- services/filestore/test/unit/js/S3PersistorTests.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/services/filestore/app/js/S3Persistor.js b/services/filestore/app/js/S3Persistor.js index 891d7be68e..dc2262c6d6 100644 --- a/services/filestore/app/js/S3Persistor.js +++ b/services/filestore/app/js/S3Persistor.js @@ -96,7 +96,7 @@ async function sendStream(bucketName, key, readStream, sourceMd5) { } const response = await _getClientForBucket(bucketName) - .upload(uploadOptions) + .upload(uploadOptions, { partSize: 100 * 1024 * 1024 }) .promise() const destMd5 = _md5FromResponse(response) diff --git a/services/filestore/test/unit/js/S3PersistorTests.js b/services/filestore/test/unit/js/S3PersistorTests.js index 9686deed5f..ac80fe4533 100644 --- a/services/filestore/test/unit/js/S3PersistorTests.js +++ b/services/filestore/test/unit/js/S3PersistorTests.js @@ -460,6 +460,12 @@ describe('S3PersistorTests', function() { }) }) + it('should upload files in a single part', function() { + expect(S3Client.upload).to.have.been.calledWith(sinon.match.any, { + partSize: 100 * 1024 * 1024 + }) + }) + it('should meter the stream', function() { expect(Stream.pipeline).to.have.been.calledWith( ReadStream,