fix(migration): Set maxSockets to avoid rate limit

This commit is contained in:
mattwr18 2020-03-30 14:14:06 +02:00
parent c59b46cf08
commit 52b5a4b0f8

View File

@ -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')