From 0371df22fe729221eb4166ae36a69601c698b414 Mon Sep 17 00:00:00 2001 From: Daniel Gorin Date: Mon, 21 Jan 2019 11:04:33 +0000 Subject: [PATCH] Check asyncUpload.maxPendingUploadMB only if enabled At the moment, if you run the server with `asyncUpload.enabled=false`, you can still get a transfer interrupted due to "too many pending uploads". This can happen, if the size of the file to upload happens to be larger than the value of `asyncUpload.maxPendingUploadMB` --- src/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 4410e91..30c3b80 100644 --- a/src/server.ts +++ b/src/server.ts @@ -277,7 +277,7 @@ export function startServer(s3: AWS.S3, config: Config, onDoneInitializing: () = res.statusCode = StatusCode.OK; // tell Bazel the PUT succeeded sendResponse(req, res, size, { startTime, awsPaused }); safeUnlinkSync(pth); - } else if (pendingUploadBytes + size > config.asyncUpload.maxPendingUploadMB * 1024 * 1024) { + } else if (config.asyncUpload.enabled && pendingUploadBytes + size > config.asyncUpload.maxPendingUploadMB * 1024 * 1024) { winston.info(`Not uploading ${s3key}, because there are already too many pending uploads`); res.statusCode = StatusCode.OK; // tell Bazel the PUT succeeded sendResponse(req, res, size, { startTime, awsPaused });