s3: make copying and uploading significantly faster

This commit is contained in:
Girish Ramakrishnan
2019-01-14 13:17:51 -08:00
parent 40c7d18382
commit ee65089eb7
2 changed files with 8 additions and 5 deletions

View File

@@ -353,12 +353,12 @@ function copy(apiConfig, oldFilePath, newFilePath) {
});
}
var total = 0, concurrency = 4;
var total = 0;
const concurrency = apiConfig.copyConcurrency || (apiConfig.provider === 's3' ? 500 : 10);
listDir(apiConfig, oldFilePath, 1000, function listDirIterator(entries, done) {
total += entries.length;
if (retryCount === 0) concurrency = Math.min(concurrency + 1, 10); else concurrency = Math.max(concurrency - 1, 5);
events.emit('progress', `Copying ${total-entries.length}-${total}. ${retryCount} errors so far. concurrency set to ${concurrency}`);
retryCount = 0;