-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy pathbullmq.d.ts
More file actions
43 lines (38 loc) · 1.15 KB
/
Copy pathbullmq.d.ts
File metadata and controls
43 lines (38 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Redis, Cluster } from 'ioredis';
declare module "bullmq" {
export type ConnectionOptions = Redis | Cluster | string;
export interface JobsOptions {
attempts?: number;
backoff?: { type: string; delay: number };
removeOnComplete?: number | boolean;
removeOnFail?: number | boolean;
delay?: number;
priority?: number;
[key: string]: unknown;
}
export class Queue<T = unknown> {
constructor(name: string, options?: { connection?: ConnectionOptions; defaultJobOptions?: JobsOptions } & Record<string, unknown>);
getRepeatableJobs(): Promise<Array<{ name: string }>>;
add(
name: string,
data: T,
options?: JobsOptions,
): Promise<unknown>;
close(): Promise<void>;
}
export class Worker<T = unknown> {
constructor(
name: string,
processor: (job: Job<T>) => Promise<void>,
options?: { connection?: ConnectionOptions } & Record<string, unknown>,
);
close(): Promise<void>;
on(event: string, callback: (...args: any[]) => void): void;
}
export class Job<T = unknown> {
data: T;
id: string;
attemptsMade: number;
opts: { attempts?: number };
}
}