Skip to content

Commit d0e42c7

Browse files
committed
fix: add check in each one of bull queue adapters
1 parent ff52103 commit d0e42c7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/api/src/queueAdapters/bull.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Job, Queue } from 'bull';
2+
import BullQueue from 'bull';
23
import {
34
JobCleanStatus,
45
JobCounts,
@@ -13,6 +14,10 @@ import { BaseAdapter } from './base';
1314
export class BullAdapter extends BaseAdapter {
1415
constructor(public queue: Queue, options: Partial<QueueAdapterOptions> = {}) {
1516
super('bull', { ...options, allowCompletedRetries: false });
17+
18+
if (!(queue instanceof BullQueue)) {
19+
throw new Error(`You've used the Bull adapter with a non-Bull queue.`);
20+
}
1621
}
1722

1823
public getRedisInfo(): Promise<string> {

packages/api/src/queueAdapters/bullMQ.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { BaseAdapter } from './base';
1313
export class BullMQAdapter extends BaseAdapter {
1414
constructor(private queue: Queue, options: Partial<QueueAdapterOptions> = {}) {
1515
super('bullmq', options);
16+
if (!(queue instanceof Queue)) {
17+
throw new Error(`You've used the BullMQ adapter with a non-BullMQ queue.`);
18+
}
1619
}
1720

1821
public async getRedisInfo(): Promise<string> {

0 commit comments

Comments
 (0)