added start worker delay

This commit is contained in:
Boki 2025-06-21 07:43:37 -04:00
parent a0e1593af9
commit 19ecd95346
6 changed files with 92 additions and 7 deletions

View file

@ -337,6 +337,24 @@ export class Queue {
}
}
/**
* Start workers manually (for delayed initialization)
*/
startWorkersManually(workerCount: number, concurrency: number = 1): void {
if (this.workers.length > 0) {
logger.warn('Workers already started for queue', { queueName: this.queueName });
return;
}
// Initialize queue events if not already done
if (!this.queueEvents) {
const connection = getRedisConnection(this.redisConfig);
this.queueEvents = new QueueEvents(`{${this.queueName}}`, { connection });
}
this.startWorkers(workerCount, concurrency);
}
/**
* Get the number of active workers
*/