🐛 Fixed batch sizing to work when batchSize = 1 (#1314)

This commit is contained in:
Omar Ajoue
2021-01-07 07:53:48 +01:00
committed by GitHub
parent af414d77fb
commit 9c479abc35

View File

@@ -656,7 +656,7 @@ export class HttpRequest implements INodeType {
if (itemIndex > 0 && options.batchSize as number >= 0 && options.batchInterval as number > 0) { if (itemIndex > 0 && options.batchSize as number >= 0 && options.batchInterval as number > 0) {
// defaults batch size to 1 of it's set to 0 // defaults batch size to 1 of it's set to 0
const batchSize: number = options.batchSize as number > 0 ? options.batchSize as number : 1; const batchSize: number = options.batchSize as number > 0 ? options.batchSize as number : 1;
if (itemIndex % batchSize === 1) { if (itemIndex % batchSize === 0) {
await new Promise(resolve => setTimeout(resolve, options.batchInterval as number)); await new Promise(resolve => setTimeout(resolve, options.batchInterval as number));
} }
} }