T-16: M0.1b — Make repo-wide bun test green: fix queue, shutdown-signal and research-workflow test failures
This commit is contained in:
parent
890761e0d5
commit
9c4e87cdfd
17 changed files with 366 additions and 266 deletions
|
|
@ -123,7 +123,7 @@ export class Queue {
|
|||
|
||||
// Initialize queue events if workers will be used
|
||||
if (config.workers && config.workers > 0) {
|
||||
this.queueEvents = new QueueEvents(queueName, { connection });
|
||||
this.queueEvents = this.createQueueEvents(connection);
|
||||
}
|
||||
|
||||
// Start workers if requested and not explicitly disabled
|
||||
|
|
@ -262,12 +262,18 @@ export class Queue {
|
|||
return await this.bullQueue.getJob(jobId);
|
||||
}
|
||||
|
||||
private createQueueEvents(connection: ReturnType<typeof getRedisConnection>): QueueEvents {
|
||||
const queueEvents = new QueueEvents(this.queueName, { connection });
|
||||
queueEvents.on('error', error =>
|
||||
this.logger.error('QueueEvents connection error', { queueName: this.queueName, error })
|
||||
);
|
||||
return queueEvents;
|
||||
}
|
||||
|
||||
/** Wait for a result using a QueueEvents connection owned by this queue. */
|
||||
async waitForJob<T>(job: Job<unknown, T>, timeout = 30000): Promise<T> {
|
||||
if (!this.queueEvents) {
|
||||
this.queueEvents = new QueueEvents(this.queueName, {
|
||||
connection: getRedisConnection(this.redisConfig),
|
||||
});
|
||||
this.queueEvents = this.createQueueEvents(getRedisConnection(this.redisConfig));
|
||||
}
|
||||
await this.queueEvents.waitUntilReady();
|
||||
return job.waitUntilFinished(this.queueEvents, timeout);
|
||||
|
|
@ -589,7 +595,7 @@ export class Queue {
|
|||
// Initialize queue events if not already done
|
||||
if (!this.queueEvents) {
|
||||
const connection = getRedisConnection(this.redisConfig);
|
||||
this.queueEvents = new QueueEvents(this.queueName, { connection });
|
||||
this.queueEvents = this.createQueueEvents(connection);
|
||||
}
|
||||
|
||||
this.startWorkers(workerCount, concurrency);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue