From 270c490a9de2199f3b4c1cc2424a10b4af651914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Sun, 9 Jul 2017 12:00:08 +0200 Subject: [PATCH] Add generate.concurrency option --- lib/builder/generator.js | 2 +- lib/core/options.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/builder/generator.js b/lib/builder/generator.js index 1f01bea614..1019afafd6 100644 --- a/lib/builder/generator.js +++ b/lib/builder/generator.js @@ -68,7 +68,7 @@ export default class Generator extends Tapable { // Start generate process while (routes.length) { let n = 0 - await Promise.all(routes.splice(0, 500).map(async ({ route, payload }) => { + await Promise.all(routes.splice(0, this.options.generate.concurrency).map(async ({ route, payload }) => { await waitFor(n++ * this.options.generate.interval) await this.generateRoute({route, payload, errors}) })) diff --git a/lib/core/options.js b/lib/core/options.js index 2a9f615d6e..3eb0017b26 100755 --- a/lib/core/options.js +++ b/lib/core/options.js @@ -74,6 +74,7 @@ export const defaultOptions = { generate: { dir: 'dist', routes: [], + concurrency: 500, interval: 0, minify: { collapseBooleanAttributes: true,