From 52b5a4b0f87fa08f84455b481310cba345ac1eec Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Mon, 30 Mar 2020 14:14:06 +0200 Subject: [PATCH] fix(migration): Set maxSockets to avoid rate limit --- .../src/db/migrations/20200312140328-bulk_upload_to_s3.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/db/migrations/20200312140328-bulk_upload_to_s3.js b/backend/src/db/migrations/20200312140328-bulk_upload_to_s3.js index 908c97b42..ee9aba023 100644 --- a/backend/src/db/migrations/20200312140328-bulk_upload_to_s3.js +++ b/backend/src/db/migrations/20200312140328-bulk_upload_to_s3.js @@ -4,6 +4,7 @@ import path from 'path' import { S3 } from 'aws-sdk' import mime from 'mime-types' import { s3Configs } from '../../config' +import https from 'https' export const description = ` Upload all image files to a S3 compatible object storage in order to reduce @@ -14,6 +15,9 @@ export async function up(next) { const driver = getDriver() const session = driver.session() const transaction = session.beginTransaction() + const agent = new https.Agent({ + maxSockets: 5, + }) const { AWS_ENDPOINT: endpoint, @@ -28,7 +32,7 @@ export async function up(next) { return } - const s3 = new S3({ region, endpoint }) + const s3 = new S3({ region, endpoint, httpOptions: { agent } }) try { // Implement your migration here. const { records } = await transaction.run('MATCH (image:Image) RETURN image.url as url')