From baa8576556e9b352c0773f3bd8a351b37e1a203d Mon Sep 17 00:00:00 2001 From: Olivier Louvignes Date: Fri, 28 Jun 2024 12:11:12 +0200 Subject: [PATCH] feat(update): minor changes --- src/PrismaQueue.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PrismaQueue.ts b/src/PrismaQueue.ts index e9c1a4c..9b1ff57 100644 --- a/src/PrismaQueue.ts +++ b/src/PrismaQueue.ts @@ -227,7 +227,9 @@ export class PrismaQueue< */ private async poll(): Promise { const { maxConcurrency, pollInterval, jobInterval } = this.config; - debug(`polling queue named="${this.name}" with maxConcurrency=${maxConcurrency}...`); + debug( + `polling queue named="${this.name}" with pollInterval=${pollInterval} maxConcurrency=${maxConcurrency}...`, + ); while (!this.stopped) { // Wait for the queue to be ready @@ -245,7 +247,7 @@ export class PrismaQueue< // Will loop until the queue is empty or stopped while (estimatedQueueSize > 0 && !this.stopped) { // Will loop until the concurrency limit is reached or stopped - while (this.concurrency < maxConcurrency && !this.stopped) { + while (estimatedQueueSize > 0 && !this.stopped && this.concurrency < maxConcurrency) { // debug(`concurrency=${this.concurrency}, maxConcurrency=${maxConcurrency}`); debug(`processing job from queue named="${this.name}"...`); this.concurrency++;