bullmq 1.52.0 → 1.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/cleanJobsInSet-1.lua +23 -8
- package/package.json +4 -2
- package/dist/bullmq.d.ts +0 -1562
- package/dist/tsdoc-metadata.json +0 -11
package/dist/bullmq.d.ts
DELETED
@@ -1,1562 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
|
3
|
-
import { ChildProcess } from 'child_process';
|
4
|
-
import { Cluster } from 'ioredis';
|
5
|
-
import { EventEmitter } from 'events';
|
6
|
-
import { Pipeline } from 'ioredis';
|
7
|
-
import { Redis } from 'ioredis';
|
8
|
-
import { RedisOptions as RedisOptions_2 } from 'ioredis';
|
9
|
-
|
10
|
-
export declare interface AddChildrenOpts {
|
11
|
-
multi: Pipeline;
|
12
|
-
nodes: FlowJob[];
|
13
|
-
parent: {
|
14
|
-
parentOpts: {
|
15
|
-
id: string;
|
16
|
-
queue: string;
|
17
|
-
};
|
18
|
-
parentDependenciesKey: string;
|
19
|
-
};
|
20
|
-
queuesOpts?: FlowQueuesOpts;
|
21
|
-
}
|
22
|
-
|
23
|
-
export declare interface AddNodeOpts {
|
24
|
-
multi: Pipeline;
|
25
|
-
node: FlowJob;
|
26
|
-
parent?: {
|
27
|
-
parentOpts: {
|
28
|
-
id: string;
|
29
|
-
queue: string;
|
30
|
-
};
|
31
|
-
parentDependenciesKey: string;
|
32
|
-
};
|
33
|
-
/**
|
34
|
-
* Queues options that will be applied in each node depending on queue name presence.
|
35
|
-
*/
|
36
|
-
queuesOpts?: FlowQueuesOpts;
|
37
|
-
}
|
38
|
-
|
39
|
-
export declare interface AdvancedOptions {
|
40
|
-
/**
|
41
|
-
* A set of custom backoff strategies keyed by name.
|
42
|
-
*/
|
43
|
-
backoffStrategies?: {};
|
44
|
-
}
|
45
|
-
|
46
|
-
export declare function array2obj(arr: string[]): {
|
47
|
-
[index: string]: string;
|
48
|
-
};
|
49
|
-
|
50
|
-
export declare type BackoffFunction = (attemptsMade?: number, err?: Error, job?: Job) => number;
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Settings for backing off failed jobs.
|
54
|
-
*
|
55
|
-
* @see {@link https://docs.bullmq.io/guide/retrying-failing-jobs}
|
56
|
-
*/
|
57
|
-
export declare interface BackoffOptions {
|
58
|
-
/**
|
59
|
-
* Name of the backoff strategy.
|
60
|
-
*/
|
61
|
-
type: string;
|
62
|
-
/**
|
63
|
-
* Delay in milliseconds.
|
64
|
-
*/
|
65
|
-
delay?: number;
|
66
|
-
}
|
67
|
-
|
68
|
-
export declare class Backoffs {
|
69
|
-
static builtinStrategies: BuiltInStrategies;
|
70
|
-
static normalize(backoff: number | BackoffOptions): BackoffOptions;
|
71
|
-
static calculate(backoff: BackoffOptions, attemptsMade: number, customStrategies: Strategies, err: Error, job: Job): number;
|
72
|
-
}
|
73
|
-
|
74
|
-
declare interface BuiltInStrategies {
|
75
|
-
[index: string]: (delay: number) => BackoffFunction;
|
76
|
-
}
|
77
|
-
|
78
|
-
export declare type BulkJobOptions = Omit<JobsOptions, 'repeat'>;
|
79
|
-
|
80
|
-
export declare class ChildPool {
|
81
|
-
retained: {
|
82
|
-
[key: number]: ChildProcessExt;
|
83
|
-
};
|
84
|
-
free: {
|
85
|
-
[key: string]: ChildProcessExt[];
|
86
|
-
};
|
87
|
-
retain(processFile: string): Promise<ChildProcessExt>;
|
88
|
-
release(child: ChildProcessExt): void;
|
89
|
-
remove(child: ChildProcessExt): void;
|
90
|
-
kill(child: ChildProcess, signal?: 'SIGTERM' | 'SIGKILL'): Promise<void>;
|
91
|
-
clean(): Promise<void>;
|
92
|
-
getFree(id: string): ChildProcessExt[];
|
93
|
-
getAllFree(): ChildProcessExt[];
|
94
|
-
}
|
95
|
-
|
96
|
-
export declare interface ChildProcessExt extends ChildProcess {
|
97
|
-
processFile?: string;
|
98
|
-
}
|
99
|
-
|
100
|
-
export declare const clientCommandMessageReg: RegExp;
|
101
|
-
|
102
|
-
export declare enum ClientType {
|
103
|
-
blocking = "blocking",
|
104
|
-
normal = "normal"
|
105
|
-
}
|
106
|
-
|
107
|
-
export declare type ConnectionOptions = RedisOptions | Redis | Cluster;
|
108
|
-
|
109
|
-
export declare function delay(ms: number): Promise<void>;
|
110
|
-
|
111
|
-
export declare const DELAY_TIME_1 = 100;
|
112
|
-
|
113
|
-
export declare const DELAY_TIME_5 = 5000;
|
114
|
-
|
115
|
-
export declare interface DependenciesOpts {
|
116
|
-
processed?: {
|
117
|
-
cursor?: number;
|
118
|
-
count?: number;
|
119
|
-
};
|
120
|
-
unprocessed?: {
|
121
|
-
cursor?: number;
|
122
|
-
count?: number;
|
123
|
-
};
|
124
|
-
}
|
125
|
-
|
126
|
-
export declare enum ErrorCodes {
|
127
|
-
JobNotExist = -1,
|
128
|
-
JobLockNotExist = -2,
|
129
|
-
JobNotInState = -3,
|
130
|
-
JobPendingDependencies = -4,
|
131
|
-
ParentJobNotExist = -5
|
132
|
-
}
|
133
|
-
|
134
|
-
export declare const errorObject: {
|
135
|
-
[index: string]: any;
|
136
|
-
};
|
137
|
-
|
138
|
-
export declare interface FlowJob {
|
139
|
-
name: string;
|
140
|
-
queueName: string;
|
141
|
-
data?: any;
|
142
|
-
prefix?: string;
|
143
|
-
opts?: Omit<JobsOptions, 'parent' | 'repeat'>;
|
144
|
-
children?: FlowJob[];
|
145
|
-
}
|
146
|
-
|
147
|
-
export declare interface FlowOpts {
|
148
|
-
queuesOptions: FlowQueuesOpts;
|
149
|
-
}
|
150
|
-
|
151
|
-
/**
|
152
|
-
* This class allows to add jobs with dependencies between them in such
|
153
|
-
* a way that it is possible to build complex flows.
|
154
|
-
* Note: A flow is a tree-like structure of jobs that depend on each other.
|
155
|
-
* Whenever the children of a given parent are completed, the parent
|
156
|
-
* will be processed, being able to access the children's result data.
|
157
|
-
* All Jobs can be in different queues, either children or parents,
|
158
|
-
*/
|
159
|
-
export declare class FlowProducer extends EventEmitter {
|
160
|
-
opts: QueueBaseOptions;
|
161
|
-
toKey: (name: string, type: string) => string;
|
162
|
-
keys: KeysMap;
|
163
|
-
closing: Promise<void>;
|
164
|
-
queueKeys: QueueKeys;
|
165
|
-
protected connection: RedisConnection;
|
166
|
-
constructor(opts?: QueueBaseOptions);
|
167
|
-
/**
|
168
|
-
* Adds a flow.
|
169
|
-
*
|
170
|
-
* This call would be atomic, either it fails and no jobs will
|
171
|
-
* be added to the queues, or it succeeds and all jobs will be added.
|
172
|
-
*
|
173
|
-
* @param flow - an object with a tree-like structure where children jobs
|
174
|
-
* will be processed before their parents.
|
175
|
-
* @param opts - options that will be applied to the flow object.
|
176
|
-
*/
|
177
|
-
add(flow: FlowJob, opts?: FlowOpts): Promise<JobNode>;
|
178
|
-
/**
|
179
|
-
* Get a flow.
|
180
|
-
*
|
181
|
-
* @param opts - an object with options for getting a JobNode.
|
182
|
-
*/
|
183
|
-
getFlow(opts: NodeOpts): Promise<JobNode>;
|
184
|
-
get client(): Promise<RedisClient>;
|
185
|
-
/**
|
186
|
-
* Adds multiple flows.
|
187
|
-
*
|
188
|
-
* A flow is a tree-like structure of jobs that depend on each other.
|
189
|
-
* Whenever the children of a given parent are completed, the parent
|
190
|
-
* will be processed, being able to access the children's result data.
|
191
|
-
*
|
192
|
-
* All Jobs can be in different queues, either children or parents,
|
193
|
-
* however this call would be atomic, either it fails and no jobs will
|
194
|
-
* be added to the queues, or it succeeds and all jobs will be added.
|
195
|
-
*
|
196
|
-
* @param flows - an array of objects with a tree-like structure where children jobs
|
197
|
-
* will be processed before their parents.
|
198
|
-
*/
|
199
|
-
addBulk(flows: FlowJob[]): Promise<JobNode[]>;
|
200
|
-
/**
|
201
|
-
* Add a node (job) of a flow to the queue. This method will recursively
|
202
|
-
* add all its children as well. Note that a given job can potentially be
|
203
|
-
* a parent and a child job at the same time depending on where it is located
|
204
|
-
* in the tree hierarchy.
|
205
|
-
*
|
206
|
-
* @param multi - ioredis pipeline
|
207
|
-
* @param node - the node representing a job to be added to some queue
|
208
|
-
* @param parent - parent data sent to children to create the "links" to their parent
|
209
|
-
* @returns
|
210
|
-
*/
|
211
|
-
private addNode;
|
212
|
-
/**
|
213
|
-
* Adds nodes (jobs) of multiple flows to the queue. This method will recursively
|
214
|
-
* add all its children as well. Note that a given job can potentially be
|
215
|
-
* a parent and a child job at the same time depending on where it is located
|
216
|
-
* in the tree hierarchy.
|
217
|
-
*
|
218
|
-
* @param multi - ioredis pipeline
|
219
|
-
* @param nodes - the nodes representing jobs to be added to some queue
|
220
|
-
* @returns
|
221
|
-
*/
|
222
|
-
private addNodes;
|
223
|
-
private getNode;
|
224
|
-
private addChildren;
|
225
|
-
private getChildren;
|
226
|
-
/**
|
227
|
-
* Helper factory method that creates a queue-like object
|
228
|
-
* required to create jobs in any queue.
|
229
|
-
*
|
230
|
-
* @param node -
|
231
|
-
* @param queueKeys -
|
232
|
-
* @returns
|
233
|
-
*/
|
234
|
-
private queueFromNode;
|
235
|
-
close(): Promise<void>;
|
236
|
-
disconnect(): Promise<void>;
|
237
|
-
}
|
238
|
-
|
239
|
-
export declare type FlowQueuesOpts = Record<string, Omit<QueueOptions, 'connection' | 'prefix'>>;
|
240
|
-
|
241
|
-
export declare interface GetNextJobOptions {
|
242
|
-
block?: boolean;
|
243
|
-
}
|
244
|
-
|
245
|
-
export declare function getParentKey(opts: {
|
246
|
-
id: string;
|
247
|
-
queue: string;
|
248
|
-
}): string;
|
249
|
-
|
250
|
-
export declare function isEmpty(obj: object): boolean;
|
251
|
-
|
252
|
-
export declare function isNotConnectionError(error: Error): boolean;
|
253
|
-
|
254
|
-
export declare function isRedisInstance(obj: any): boolean;
|
255
|
-
|
256
|
-
export declare class Job<DataType = any, ReturnType = any, NameType extends string = string> {
|
257
|
-
private queue;
|
258
|
-
/**
|
259
|
-
* The name of the Job
|
260
|
-
*/
|
261
|
-
name: NameType;
|
262
|
-
/**
|
263
|
-
* The payload for this job.
|
264
|
-
*/
|
265
|
-
data: DataType;
|
266
|
-
/**
|
267
|
-
* The options object for this job.
|
268
|
-
*/
|
269
|
-
opts: JobsOptions;
|
270
|
-
id?: string;
|
271
|
-
/**
|
272
|
-
* The progress a job has performed so far.
|
273
|
-
*/
|
274
|
-
progress: number | object;
|
275
|
-
/**
|
276
|
-
* The value returned by the processor when processing this job.
|
277
|
-
*/
|
278
|
-
returnvalue: ReturnType;
|
279
|
-
/**
|
280
|
-
* Stacktrace for the error (for failed jobs).
|
281
|
-
*/
|
282
|
-
stacktrace: string[];
|
283
|
-
/**
|
284
|
-
* Timestamp when the job was created (unless overridden with job options).
|
285
|
-
*/
|
286
|
-
timestamp: number;
|
287
|
-
/**
|
288
|
-
* Number of attempts after the job has failed.
|
289
|
-
*/
|
290
|
-
attemptsMade: number;
|
291
|
-
/**
|
292
|
-
* Reason for failing.
|
293
|
-
*/
|
294
|
-
failedReason: string;
|
295
|
-
/**
|
296
|
-
* Timestamp for when the job finished (completed or failed).
|
297
|
-
*/
|
298
|
-
finishedOn?: number;
|
299
|
-
/**
|
300
|
-
* Timestamp for when the job was processed.
|
301
|
-
*/
|
302
|
-
processedOn?: number;
|
303
|
-
/**
|
304
|
-
* Fully qualified key (including the queue prefix) pointing to the parent of this job.
|
305
|
-
*/
|
306
|
-
parentKey?: string;
|
307
|
-
private toKey;
|
308
|
-
private discarded;
|
309
|
-
constructor(queue: MinimalQueue,
|
310
|
-
/**
|
311
|
-
* The name of the Job
|
312
|
-
*/
|
313
|
-
name: NameType,
|
314
|
-
/**
|
315
|
-
* The payload for this job.
|
316
|
-
*/
|
317
|
-
data: DataType,
|
318
|
-
/**
|
319
|
-
* The options object for this job.
|
320
|
-
*/
|
321
|
-
opts?: JobsOptions, id?: string);
|
322
|
-
/**
|
323
|
-
* Creates a new job and adds it to the queue.
|
324
|
-
*
|
325
|
-
* @param queue - the queue where to add the job.
|
326
|
-
* @param name - the name of the job.
|
327
|
-
* @param data - the payload of the job.
|
328
|
-
* @param opts - the options bag for this job.
|
329
|
-
* @returns
|
330
|
-
*/
|
331
|
-
static create<T = any, R = any, N extends string = string>(queue: MinimalQueue, name: N, data: T, opts?: JobsOptions): Promise<Job<T, R, N>>;
|
332
|
-
/**
|
333
|
-
* Creates a bulk of jobs and adds them atomically to the given queue.
|
334
|
-
*
|
335
|
-
* @param queue -the queue were to add the jobs.
|
336
|
-
* @param jobs - an array of jobs to be added to the queue.
|
337
|
-
* @returns
|
338
|
-
*/
|
339
|
-
static createBulk<T = any, R = any, N extends string = string>(queue: MinimalQueue, jobs: {
|
340
|
-
name: N;
|
341
|
-
data: T;
|
342
|
-
opts?: BulkJobOptions;
|
343
|
-
}[]): Promise<Job<T, R, N>[]>;
|
344
|
-
/**
|
345
|
-
* Instantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)
|
346
|
-
*
|
347
|
-
* @param queue - the queue where the job belongs to.
|
348
|
-
* @param json - the plain object containing the job.
|
349
|
-
* @param jobId - an optional job id (overrides the id coming from the JSON object)
|
350
|
-
* @returns
|
351
|
-
*/
|
352
|
-
static fromJSON(queue: MinimalQueue, json: JobJsonRaw, jobId?: string): Job<any, any, string>;
|
353
|
-
/**
|
354
|
-
* Fetches a Job from the queue given the passed job id.
|
355
|
-
*
|
356
|
-
* @param queue - the queue where the job belongs to.
|
357
|
-
* @param jobId - the job id.
|
358
|
-
* @returns
|
359
|
-
*/
|
360
|
-
static fromId(queue: MinimalQueue, jobId: string): Promise<Job | undefined>;
|
361
|
-
toJSON(): Pick<this, Exclude<keyof this, "queue">>;
|
362
|
-
/**
|
363
|
-
* Prepares a job to be serialized for storage in Redis.
|
364
|
-
* @returns
|
365
|
-
*/
|
366
|
-
asJSON(): JobJson;
|
367
|
-
/**
|
368
|
-
* Updates a job's data
|
369
|
-
*
|
370
|
-
* @param data - the data that will replace the current jobs data.
|
371
|
-
*/
|
372
|
-
update(data: DataType): Promise<void>;
|
373
|
-
/**
|
374
|
-
* Updates a job's progress
|
375
|
-
*
|
376
|
-
* @param progress - number or object to be saved as progress.
|
377
|
-
*/
|
378
|
-
updateProgress(progress: number | object): Promise<void>;
|
379
|
-
/**
|
380
|
-
* Logs one row of log data.
|
381
|
-
*
|
382
|
-
* @param logRow - string with log data to be logged.
|
383
|
-
*/
|
384
|
-
log(logRow: string): Promise<number>;
|
385
|
-
/**
|
386
|
-
* Completely remove the job from the queue.
|
387
|
-
* Note, this call will throw an exception if the job
|
388
|
-
* is being processed when the call is performed.
|
389
|
-
*/
|
390
|
-
remove(): Promise<void>;
|
391
|
-
/**
|
392
|
-
* Extend the lock for this job.
|
393
|
-
*
|
394
|
-
* @param token - unique token for the lock
|
395
|
-
* @param duration - lock duration in milliseconds
|
396
|
-
*/
|
397
|
-
extendLock(token: string, duration: number): Promise<number>;
|
398
|
-
/**
|
399
|
-
* Moves a job to the completed queue.
|
400
|
-
* Returned job to be used with Queue.prototype.nextJobFromJobData.
|
401
|
-
*
|
402
|
-
* @param returnValue - The jobs success message.
|
403
|
-
* @param token - Worker token used to acquire completed job.
|
404
|
-
* @param fetchNext - True when wanting to fetch the next job.
|
405
|
-
* @returns Returns the jobData of the next job in the waiting queue.
|
406
|
-
*/
|
407
|
-
moveToCompleted(returnValue: ReturnType, token: string, fetchNext?: boolean): Promise<[JobJsonRaw, string] | []>;
|
408
|
-
/**
|
409
|
-
* Moves a job to the failed queue.
|
410
|
-
*
|
411
|
-
* @param err - the jobs error message.
|
412
|
-
* @param token - token to check job is locked by current worker
|
413
|
-
* @param fetchNext - true when wanting to fetch the next job
|
414
|
-
* @returns void
|
415
|
-
*/
|
416
|
-
moveToFailed(err: Error, token: string, fetchNext?: boolean): Promise<void>;
|
417
|
-
/**
|
418
|
-
* @returns true if the job has completed.
|
419
|
-
*/
|
420
|
-
isCompleted(): Promise<boolean>;
|
421
|
-
/**
|
422
|
-
* @returns true if the job has failed.
|
423
|
-
*/
|
424
|
-
isFailed(): Promise<boolean>;
|
425
|
-
/**
|
426
|
-
* @returns true if the job is delayed.
|
427
|
-
*/
|
428
|
-
isDelayed(): Promise<boolean>;
|
429
|
-
/**
|
430
|
-
* @returns true if the job is waiting for children.
|
431
|
-
*/
|
432
|
-
isWaitingChildren(): Promise<boolean>;
|
433
|
-
/**
|
434
|
-
* @returns true of the job is active.
|
435
|
-
*/
|
436
|
-
isActive(): Promise<boolean>;
|
437
|
-
/**
|
438
|
-
* @returns true if the job is waiting.
|
439
|
-
*/
|
440
|
-
isWaiting(): Promise<boolean>;
|
441
|
-
get queueName(): string;
|
442
|
-
/**
|
443
|
-
* Get current state.
|
444
|
-
*
|
445
|
-
* @returns Returns one of these values:
|
446
|
-
* 'completed', 'failed', 'delayed', 'active', 'waiting', 'waiting-children', 'unknown'.
|
447
|
-
*/
|
448
|
-
getState(): Promise<string>;
|
449
|
-
/**
|
450
|
-
* Change delay of a delayed job.
|
451
|
-
*
|
452
|
-
* @param delay - milliseconds to be added to current time.
|
453
|
-
* @returns void
|
454
|
-
*/
|
455
|
-
changeDelay(delay: number): Promise<void>;
|
456
|
-
/**
|
457
|
-
* Get this jobs children result values if any.
|
458
|
-
*
|
459
|
-
* @returns Object mapping children job keys with their values.
|
460
|
-
*/
|
461
|
-
getChildrenValues<CT = any>(): Promise<{
|
462
|
-
[jobKey: string]: CT;
|
463
|
-
}>;
|
464
|
-
/**
|
465
|
-
* Get children job keys if this job is a parent and has children.
|
466
|
-
*
|
467
|
-
* @returns dependencies separated by processed and unprocessed.
|
468
|
-
*/
|
469
|
-
getDependencies(opts?: DependenciesOpts): Promise<{
|
470
|
-
nextProcessedCursor?: number;
|
471
|
-
processed?: Record<string, any>;
|
472
|
-
nextUnprocessedCursor?: number;
|
473
|
-
unprocessed?: string[];
|
474
|
-
}>;
|
475
|
-
/**
|
476
|
-
* Get children job counts if this job is a parent and has children.
|
477
|
-
*
|
478
|
-
* @returns dependencies count separated by processed and unprocessed.
|
479
|
-
*/
|
480
|
-
getDependenciesCount(opts?: {
|
481
|
-
processed?: boolean;
|
482
|
-
unprocessed?: boolean;
|
483
|
-
}): Promise<{
|
484
|
-
processed?: number;
|
485
|
-
unprocessed?: number;
|
486
|
-
}>;
|
487
|
-
/**
|
488
|
-
* Returns a promise the resolves when the job has finished. (completed or failed).
|
489
|
-
*/
|
490
|
-
waitUntilFinished(queueEvents: QueueEvents, ttl?: number): Promise<ReturnType>;
|
491
|
-
/**
|
492
|
-
* Moves the job to the delay set.
|
493
|
-
*
|
494
|
-
* @param timestamp - timestamp where the job should be moved back to "wait"
|
495
|
-
* @returns
|
496
|
-
*/
|
497
|
-
moveToDelayed(timestamp: number): Promise<void>;
|
498
|
-
/**
|
499
|
-
* Moves the job to the waiting-children set.
|
500
|
-
*
|
501
|
-
* @param token - Token to check job is locked by current worker
|
502
|
-
* @param opts - The options bag for moving a job to waiting-children.
|
503
|
-
* @returns true if the job was moved
|
504
|
-
*/
|
505
|
-
moveToWaitingChildren(token: string, opts?: MoveToChildrenOpts): Promise<boolean | Error>;
|
506
|
-
/**
|
507
|
-
* Promotes a delayed job so that it starts to be processed as soon as possible.
|
508
|
-
*/
|
509
|
-
promote(): Promise<void>;
|
510
|
-
/**
|
511
|
-
* Attempts to retry the job. Only a job that has failed can be retried.
|
512
|
-
*
|
513
|
-
* @returns If resolved and return code is 1, then the queue emits a waiting event
|
514
|
-
* otherwise the operation was not a success and throw the corresponding error. If the promise
|
515
|
-
* rejects, it indicates that the script failed to execute
|
516
|
-
*/
|
517
|
-
retry(state?: 'completed' | 'failed'): Promise<void>;
|
518
|
-
/**
|
519
|
-
* Marks a job to not be retried if it fails (even if attempts has been configured)
|
520
|
-
*/
|
521
|
-
discard(): void;
|
522
|
-
private isInZSet;
|
523
|
-
private isInList;
|
524
|
-
/**
|
525
|
-
* Adds the job to Redis.
|
526
|
-
*
|
527
|
-
* @param client -
|
528
|
-
* @param parentOpts -
|
529
|
-
* @returns
|
530
|
-
*/
|
531
|
-
addJob(client: RedisClient, parentOpts?: ParentOpts): Promise<string>;
|
532
|
-
private saveAttempt;
|
533
|
-
}
|
534
|
-
|
535
|
-
export declare function jobIdForGroup(jobOpts: JobsOptions, data: any, queueOpts: QueueOptions): string;
|
536
|
-
|
537
|
-
export declare interface JobJson {
|
538
|
-
id: string;
|
539
|
-
name: string;
|
540
|
-
data: string;
|
541
|
-
opts: JobsOptions;
|
542
|
-
progress: number | object;
|
543
|
-
attemptsMade: number;
|
544
|
-
finishedOn?: number;
|
545
|
-
processedOn?: number;
|
546
|
-
timestamp: number;
|
547
|
-
failedReason: string;
|
548
|
-
stacktrace: string;
|
549
|
-
returnvalue: string;
|
550
|
-
parentKey?: string;
|
551
|
-
}
|
552
|
-
|
553
|
-
export declare interface JobJsonRaw {
|
554
|
-
id: string;
|
555
|
-
name: string;
|
556
|
-
data: string;
|
557
|
-
opts: string;
|
558
|
-
progress: string;
|
559
|
-
attemptsMade: string;
|
560
|
-
finishedOn?: string;
|
561
|
-
processedOn?: string;
|
562
|
-
timestamp: string;
|
563
|
-
failedReason: string;
|
564
|
-
stacktrace: string[];
|
565
|
-
returnvalue: string;
|
566
|
-
parentKey?: string;
|
567
|
-
}
|
568
|
-
|
569
|
-
export declare interface JobNode {
|
570
|
-
job: Job;
|
571
|
-
children?: JobNode[];
|
572
|
-
}
|
573
|
-
|
574
|
-
export declare interface JobsOptions {
|
575
|
-
/**
|
576
|
-
* Timestamp when the job was created. Defaults to `Date.now()`.
|
577
|
-
*/
|
578
|
-
timestamp?: number;
|
579
|
-
/**
|
580
|
-
* Ranges from 1 (highest priority) to MAX_INT (lowest priority). Note that
|
581
|
-
* using priorities has a slight impact on performance,
|
582
|
-
* so do not use it if not required.
|
583
|
-
*/
|
584
|
-
priority?: number;
|
585
|
-
/**
|
586
|
-
* An amount of milliseconds to wait until this job can be processed.
|
587
|
-
* Note that for accurate delays, worker and producers
|
588
|
-
* should have their clocks synchronized.
|
589
|
-
*/
|
590
|
-
delay?: number;
|
591
|
-
/**
|
592
|
-
* The total number of attempts to try the job until it completes.
|
593
|
-
*/
|
594
|
-
attempts?: number;
|
595
|
-
/**
|
596
|
-
* Repeat this job, for example based on a `cron` schedule.
|
597
|
-
*/
|
598
|
-
repeat?: RepeatOptions;
|
599
|
-
/**
|
600
|
-
* Rate limiter key to use if rate limiter enabled.
|
601
|
-
*
|
602
|
-
* @see {@link https://docs.bullmq.io/guide/rate-limiting}
|
603
|
-
*/
|
604
|
-
rateLimiterKey?: string;
|
605
|
-
/**
|
606
|
-
* Backoff setting for automatic retries if the job fails
|
607
|
-
*/
|
608
|
-
backoff?: number | BackoffOptions;
|
609
|
-
/**
|
610
|
-
* If true, adds the job to the right of the queue instead of the left (default false)
|
611
|
-
*
|
612
|
-
* @see {@link https://docs.bullmq.io/guide/jobs/lifo}
|
613
|
-
*/
|
614
|
-
lifo?: boolean;
|
615
|
-
/**
|
616
|
-
* The number of milliseconds after which the job should be
|
617
|
-
* fail with a timeout error.
|
618
|
-
*/
|
619
|
-
timeout?: number;
|
620
|
-
/**
|
621
|
-
* Override the job ID - by default, the job ID is a unique
|
622
|
-
* integer, but you can use this setting to override it.
|
623
|
-
* If you use this option, it is up to you to ensure the
|
624
|
-
* jobId is unique. If you attempt to add a job with an id that
|
625
|
-
* already exists, it will not be added.
|
626
|
-
*/
|
627
|
-
jobId?: string;
|
628
|
-
/**
|
629
|
-
* If true, removes the job when it successfully completes
|
630
|
-
* When given an number, it specifies the maximum amount of
|
631
|
-
* jobs to keep.
|
632
|
-
* Default behavior is to keep the job in the completed set.
|
633
|
-
*/
|
634
|
-
removeOnComplete?: boolean | number;
|
635
|
-
/**
|
636
|
-
* If true, removes the job when it fails after all attempts.
|
637
|
-
* When given an number, it specifies the maximum amount of
|
638
|
-
* jobs to keep.
|
639
|
-
*/
|
640
|
-
removeOnFail?: boolean | number;
|
641
|
-
/**
|
642
|
-
* Limits the amount of stack trace lines that will be recorded in the stacktrace.
|
643
|
-
*/
|
644
|
-
stackTraceLimit?: number;
|
645
|
-
/**
|
646
|
-
*
|
647
|
-
*/
|
648
|
-
parent?: {
|
649
|
-
id: string;
|
650
|
-
queue: string;
|
651
|
-
};
|
652
|
-
/**
|
653
|
-
* Internal property used by repeatable jobs.
|
654
|
-
*/
|
655
|
-
prevMillis?: number;
|
656
|
-
/**
|
657
|
-
* Limits the size in bytes of the job's data payload (as a JSON serialized string).
|
658
|
-
*/
|
659
|
-
sizeLimit?: number;
|
660
|
-
}
|
661
|
-
|
662
|
-
declare type KeysMap = {
|
663
|
-
[index in string]: string;
|
664
|
-
};
|
665
|
-
|
666
|
-
/**
|
667
|
-
* Checks the size of string for ascii/non-ascii characters
|
668
|
-
* @see https://stackoverflow.com/a/23318053/1347170
|
669
|
-
* @param str -
|
670
|
-
*/
|
671
|
-
export declare function lengthInUtf8Bytes(str: string): number;
|
672
|
-
|
673
|
-
export declare const load: (client: RedisClient, pathname: string) => Promise<void>;
|
674
|
-
|
675
|
-
export declare type MinimalQueue = Pick<QueueBase, 'name' | 'client' | 'toKey' | 'keys' | 'opts' | 'closing' | 'waitUntilReady' | 'removeListener' | 'emit' | 'on' | 'redisVersion'>;
|
676
|
-
|
677
|
-
export declare interface MoveToChildrenOpts {
|
678
|
-
timestamp?: number;
|
679
|
-
child?: {
|
680
|
-
id: string;
|
681
|
-
queue: string;
|
682
|
-
};
|
683
|
-
}
|
684
|
-
|
685
|
-
export declare interface NodeOpts {
|
686
|
-
/**
|
687
|
-
* Root job queue name.
|
688
|
-
*/
|
689
|
-
queueName: string;
|
690
|
-
/**
|
691
|
-
* Prefix included in job key.
|
692
|
-
*/
|
693
|
-
prefix?: string;
|
694
|
-
/**
|
695
|
-
* Root job id.
|
696
|
-
*/
|
697
|
-
id: string;
|
698
|
-
/**
|
699
|
-
* Maximum depth or levels to visit in the tree.
|
700
|
-
*/
|
701
|
-
depth?: number;
|
702
|
-
/**
|
703
|
-
* Maximum quantity of children per type (processed, unprocessed).
|
704
|
-
*/
|
705
|
-
maxChildren?: number;
|
706
|
-
}
|
707
|
-
|
708
|
-
export declare type ParentOpts = {
|
709
|
-
waitChildrenKey?: string;
|
710
|
-
parentDependenciesKey?: string;
|
711
|
-
parentKey?: string;
|
712
|
-
};
|
713
|
-
|
714
|
-
/**
|
715
|
-
* An async function that receives `Job`s and handles them.
|
716
|
-
*/
|
717
|
-
export declare type Processor<T = any, R = any, N extends string = string> = (job: Job<T, R, N>, token?: string) => Promise<R>;
|
718
|
-
|
719
|
-
/**
|
720
|
-
* Queue
|
721
|
-
*
|
722
|
-
* This class provides methods to add jobs to a queue and some othe high-level
|
723
|
-
* administration such as pausing or deleting queues.
|
724
|
-
*
|
725
|
-
*/
|
726
|
-
export declare class Queue<DataType = any, ResultType = any, NameType extends string = string> extends QueueGetters implements QueueDeclaration<DataType, ResultType, NameType> {
|
727
|
-
token: string;
|
728
|
-
jobsOpts: JobsOptions;
|
729
|
-
limiter: {
|
730
|
-
groupKey: string;
|
731
|
-
};
|
732
|
-
private _repeat;
|
733
|
-
constructor(name: string, opts?: QueueOptions, Connection?: typeof RedisConnection);
|
734
|
-
/**
|
735
|
-
* Returns this instance current default job options.
|
736
|
-
*/
|
737
|
-
get defaultJobOptions(): JobsOptions;
|
738
|
-
get repeat(): Promise<Repeat>;
|
739
|
-
/**
|
740
|
-
* Adds a new job to the queue.
|
741
|
-
*
|
742
|
-
* @param name - Name of the job to be added to the queue,.
|
743
|
-
* @param data - Arbitrary data to append to the job.
|
744
|
-
* @param opts - Job options that affects how the job is going to be processed.
|
745
|
-
*/
|
746
|
-
add(name: NameType, data: DataType, opts?: JobsOptions): Promise<Job<DataType, ResultType, NameType>>;
|
747
|
-
/**
|
748
|
-
* Adds an array of jobs to the queue.
|
749
|
-
*
|
750
|
-
* @param jobs - The array of jobs to add to the queue. Each job is defined by 3
|
751
|
-
* properties, 'name', 'data' and 'opts'. They follow the same signature as 'Queue.add'.
|
752
|
-
*/
|
753
|
-
addBulk(jobs: {
|
754
|
-
name: NameType;
|
755
|
-
data: DataType;
|
756
|
-
opts?: BulkJobOptions;
|
757
|
-
}[]): Promise<Job<DataType, any, NameType>[]>;
|
758
|
-
/**
|
759
|
-
* Pauses the processing of this queue globally.
|
760
|
-
*
|
761
|
-
* We use an atomic RENAME operation on the wait queue. Since
|
762
|
-
* we have blocking calls with BRPOPLPUSH on the wait queue, as long as the queue
|
763
|
-
* is renamed to 'paused', no new jobs will be processed (the current ones
|
764
|
-
* will run until finalized).
|
765
|
-
*
|
766
|
-
* Adding jobs requires a LUA script to check first if the paused list exist
|
767
|
-
* and in that case it will add it there instead of the wait list.
|
768
|
-
*/
|
769
|
-
pause(): Promise<void>;
|
770
|
-
/**
|
771
|
-
* Resumes the processing of this queue globally.
|
772
|
-
*
|
773
|
-
* The method reverses the pause operation by resuming the processing of the
|
774
|
-
* queue.
|
775
|
-
*/
|
776
|
-
resume(): Promise<void>;
|
777
|
-
/**
|
778
|
-
* Returns true if the queue is currently paused.
|
779
|
-
*/
|
780
|
-
isPaused(): Promise<boolean>;
|
781
|
-
/**
|
782
|
-
* Get all repeatable meta jobs.
|
783
|
-
*
|
784
|
-
* @param start - Offset of first job to return.
|
785
|
-
* @param end - Offset of last job to return.
|
786
|
-
* @param asc - Determine the order in which jobs are returned based on their
|
787
|
-
* next execution time.
|
788
|
-
*/
|
789
|
-
getRepeatableJobs(start?: number, end?: number, asc?: boolean): Promise<{
|
790
|
-
key: string;
|
791
|
-
name: string;
|
792
|
-
id: string;
|
793
|
-
endDate: number;
|
794
|
-
tz: string;
|
795
|
-
cron: string;
|
796
|
-
next: number;
|
797
|
-
}[]>;
|
798
|
-
removeRepeatable(name: NameType, repeatOpts: RepeatOptions, jobId?: string): Promise<any>;
|
799
|
-
removeRepeatableByKey(key: string): Promise<any>;
|
800
|
-
/**
|
801
|
-
* Removes the given job from the queue as well as all its
|
802
|
-
* dependencies.
|
803
|
-
*
|
804
|
-
* @param jobId - The id of the job to remove
|
805
|
-
* @returns 1 if it managed to remove the job or 0 if the job or
|
806
|
-
* any of its dependencies was locked.
|
807
|
-
*/
|
808
|
-
remove(jobId: string): Promise<number>;
|
809
|
-
/**
|
810
|
-
* Drains the queue, i.e., removes all jobs that are waiting
|
811
|
-
* or delayed, but not active, completed or failed.
|
812
|
-
*
|
813
|
-
* @param delayed - Pass true if it should also clean the
|
814
|
-
* delayed jobs.
|
815
|
-
*/
|
816
|
-
drain(delayed?: boolean): Promise<void>;
|
817
|
-
/**
|
818
|
-
* Cleans jobs from a queue. Similar to drain but keeps jobs within a certain
|
819
|
-
* grace period.
|
820
|
-
*
|
821
|
-
* @param grace - The grace period
|
822
|
-
* @param The - Max number of jobs to clean
|
823
|
-
* @param {string} [type=completed] - The type of job to clean
|
824
|
-
* Possible values are completed, wait, active, paused, delayed, failed. Defaults to completed.
|
825
|
-
* @returns Id jobs from the deleted records
|
826
|
-
*/
|
827
|
-
clean(grace: number, limit: number, type?: 'completed' | 'wait' | 'active' | 'paused' | 'delayed' | 'failed'): Promise<string[]>;
|
828
|
-
/**
|
829
|
-
* Completely destroys the queue and all of its contents irreversibly.
|
830
|
-
* This method will the *pause* the queue and requires that there are no
|
831
|
-
* active jobs. It is possible to bypass this requirement, i.e. not
|
832
|
-
* having active jobs using the "force" option.
|
833
|
-
*
|
834
|
-
* Note: This operation requires to iterate on all the jobs stored in the queue
|
835
|
-
* and can be slow for very large queues.
|
836
|
-
*
|
837
|
-
* @param { { force: boolean, count: number }} opts. Use force = true to force obliteration even
|
838
|
-
* with active jobs in the queue. Use count with the maximum number of deleted keys per iteration,
|
839
|
-
* 1000 is the default.
|
840
|
-
*/
|
841
|
-
obliterate(opts?: {
|
842
|
-
force?: boolean;
|
843
|
-
count?: number;
|
844
|
-
}): Promise<void>;
|
845
|
-
/**
|
846
|
-
* Trim the event stream to an approximately maxLength.
|
847
|
-
*
|
848
|
-
* @param maxLength -
|
849
|
-
*/
|
850
|
-
trimEvents(maxLength: number): Promise<number>;
|
851
|
-
}
|
852
|
-
|
853
|
-
export declare class QueueBase extends EventEmitter {
|
854
|
-
readonly name: string;
|
855
|
-
opts: QueueBaseOptions;
|
856
|
-
toKey: (type: string) => string;
|
857
|
-
keys: KeysMap;
|
858
|
-
closing: Promise<void>;
|
859
|
-
protected connection: RedisConnection;
|
860
|
-
constructor(name: string, opts?: QueueBaseOptions, Connection?: typeof RedisConnection);
|
861
|
-
get client(): Promise<RedisClient>;
|
862
|
-
get redisVersion(): string;
|
863
|
-
emit(event: string | symbol, ...args: any[]): boolean;
|
864
|
-
waitUntilReady(): Promise<RedisClient>;
|
865
|
-
protected base64Name(): string;
|
866
|
-
protected clientName(): string;
|
867
|
-
close(): Promise<void>;
|
868
|
-
disconnect(): Promise<void>;
|
869
|
-
}
|
870
|
-
|
871
|
-
/**
|
872
|
-
* Base Queue options
|
873
|
-
*/
|
874
|
-
export declare interface QueueBaseOptions {
|
875
|
-
/**
|
876
|
-
* Options for connecting to a Redis instance.
|
877
|
-
*/
|
878
|
-
connection?: ConnectionOptions;
|
879
|
-
/**
|
880
|
-
* Specify if the connection is shared.
|
881
|
-
*/
|
882
|
-
sharedConnection?: boolean;
|
883
|
-
/**
|
884
|
-
* Prefix for all queue keys.
|
885
|
-
*/
|
886
|
-
prefix?: string;
|
887
|
-
}
|
888
|
-
|
889
|
-
export declare interface QueueDeclaration<DataType, ResultType, NameType extends string> {
|
890
|
-
on(event: 'cleaned', listener: (jobs: string[], type: string) => void): this;
|
891
|
-
on(event: 'waiting', listener: (job: Job<DataType, ResultType, NameType>) => void): this;
|
892
|
-
on(event: string, listener: Function): this;
|
893
|
-
}
|
894
|
-
|
895
|
-
/**
|
896
|
-
* The QueueEvents class is used for listening to the global events
|
897
|
-
* emitted by a given queue.
|
898
|
-
*
|
899
|
-
* This class requires a dedicated redis connection.
|
900
|
-
*
|
901
|
-
*/
|
902
|
-
export declare class QueueEvents extends QueueBase implements QueueEventsDeclaration {
|
903
|
-
private running;
|
904
|
-
constructor(name: string, { connection, autorun, ...opts }?: QueueEventsOptions, Connection?: typeof RedisConnection);
|
905
|
-
run(): Promise<void>;
|
906
|
-
private consumeEvents;
|
907
|
-
close(): Promise<void>;
|
908
|
-
}
|
909
|
-
|
910
|
-
export declare interface QueueEventsDeclaration {
|
911
|
-
/**
|
912
|
-
* Listen to 'active' event.
|
913
|
-
*
|
914
|
-
* This event is triggered when a job enters the 'active' state.
|
915
|
-
*
|
916
|
-
* @param {'active'} event
|
917
|
-
* @callback listener@callback listener
|
918
|
-
*/
|
919
|
-
on(event: 'active', listener: (args: {
|
920
|
-
jobId: string;
|
921
|
-
prev?: string;
|
922
|
-
}, id: string) => void): this;
|
923
|
-
/**
|
924
|
-
* Listen to 'added' event.
|
925
|
-
*
|
926
|
-
* This event is triggered when a job is created.
|
927
|
-
*
|
928
|
-
* @param {'added'} event
|
929
|
-
* @callback listener@callback listener
|
930
|
-
*/
|
931
|
-
on(event: 'added', listener: (args: {
|
932
|
-
jobId: string;
|
933
|
-
name: string;
|
934
|
-
data: string;
|
935
|
-
opts: string;
|
936
|
-
}, id: string) => void): this;
|
937
|
-
/**
|
938
|
-
* Listen to 'completed' event.
|
939
|
-
*
|
940
|
-
* This event is triggered when a job has successfully completed.
|
941
|
-
*
|
942
|
-
* @param {'completed'} event
|
943
|
-
* @callback listener@callback listener
|
944
|
-
*/
|
945
|
-
on(event: 'completed', listener: (args: {
|
946
|
-
jobId: string;
|
947
|
-
returnvalue: string;
|
948
|
-
prev?: string;
|
949
|
-
}, id: string) => void): this;
|
950
|
-
/**
|
951
|
-
* Listen to 'delayed' event.
|
952
|
-
*
|
953
|
-
* This event is triggered when a job is delayed.
|
954
|
-
*
|
955
|
-
* @param {'delayed'} event
|
956
|
-
* @callback listener@callback listener
|
957
|
-
*/
|
958
|
-
on(event: 'delayed', listener: (args: {
|
959
|
-
jobId: string;
|
960
|
-
delay: number;
|
961
|
-
}, id: string) => void): this;
|
962
|
-
/**
|
963
|
-
* Listen to 'drained' event.
|
964
|
-
*
|
965
|
-
* This event is triggered when the queue has drained the waiting list.
|
966
|
-
* Note that there could still be delayed jobs waiting their timers to expire
|
967
|
-
* and this event will still be triggered as long as the waiting list has emptied.
|
968
|
-
*
|
969
|
-
* @param {'drained'} event
|
970
|
-
* @callback listener@callback listener
|
971
|
-
*/
|
972
|
-
on(event: 'drained', listener: (id: string) => void): this;
|
973
|
-
/**
|
974
|
-
* Listen to 'progress' event.
|
975
|
-
*
|
976
|
-
* This event is triggered when a job updates it progress, i.e. the
|
977
|
-
* Job##updateProgress() method is called. This is useful to notify
|
978
|
-
* progress or any other data from within a processor to the rest of the
|
979
|
-
* world.
|
980
|
-
*
|
981
|
-
* @param {'progress'} event
|
982
|
-
* @callback listener@callback listener
|
983
|
-
*/
|
984
|
-
on(event: 'progress', listener: (args: {
|
985
|
-
jobId: string;
|
986
|
-
data: number | object;
|
987
|
-
}, id: string) => void): this;
|
988
|
-
/**
|
989
|
-
* Listen to 'waiting' event.
|
990
|
-
*
|
991
|
-
* This event is triggered when a job enters the 'waiting' state.
|
992
|
-
*
|
993
|
-
* @param {'waiting'} event
|
994
|
-
* @callback listener@callback listener
|
995
|
-
*/
|
996
|
-
on(event: 'waiting', listener: (args: {
|
997
|
-
jobId: string;
|
998
|
-
}, id: string) => void): this;
|
999
|
-
/**
|
1000
|
-
* Listen to 'stalled' event.
|
1001
|
-
*
|
1002
|
-
* This event is triggered when a job has been moved from 'active' back
|
1003
|
-
* to 'waiting'/'failed' due to the processor not being able to renew
|
1004
|
-
* the lock on the said job.
|
1005
|
-
*
|
1006
|
-
* @param {'stalled'} event
|
1007
|
-
* @callback listener@callback listener
|
1008
|
-
*/
|
1009
|
-
on(event: 'stalled', listener: (args: {
|
1010
|
-
jobId: string;
|
1011
|
-
}, id: string) => void): this;
|
1012
|
-
/**
|
1013
|
-
* Listen to 'failed' event.
|
1014
|
-
*
|
1015
|
-
* This event is triggered when a job has thrown an exception.
|
1016
|
-
*
|
1017
|
-
* @param {'failed'} event
|
1018
|
-
* @callback listener@callback listener
|
1019
|
-
*/
|
1020
|
-
on(event: 'failed', listener: (args: {
|
1021
|
-
jobId: string;
|
1022
|
-
failedReason: string;
|
1023
|
-
prev?: string;
|
1024
|
-
}, id: string) => void): this;
|
1025
|
-
/**
|
1026
|
-
* Listen to 'removed' event.
|
1027
|
-
*
|
1028
|
-
* This event is triggered when a job has been manually
|
1029
|
-
* removed from the queue.
|
1030
|
-
*
|
1031
|
-
* @param {'removed'} event
|
1032
|
-
* @callback listener@callback listener
|
1033
|
-
*/
|
1034
|
-
on(event: 'removed', listener: (args: {
|
1035
|
-
jobId: string;
|
1036
|
-
}, id: string) => void): this;
|
1037
|
-
/**
|
1038
|
-
* Listen to 'waiting-children' event.
|
1039
|
-
*
|
1040
|
-
* This event is triggered when a job enters the 'waiting-children' state.
|
1041
|
-
*
|
1042
|
-
* @param {'waiting-children'} event
|
1043
|
-
* @callback listener@callback listener
|
1044
|
-
*/
|
1045
|
-
on(event: 'waiting-children', listener: (args: {
|
1046
|
-
jobId: string;
|
1047
|
-
}, id: string) => void): this;
|
1048
|
-
on(event: string, listener: Function): this;
|
1049
|
-
}
|
1050
|
-
|
1051
|
-
/**
|
1052
|
-
* Options for QueueEvents
|
1053
|
-
*/
|
1054
|
-
export declare interface QueueEventsOptions extends QueueBaseOptions {
|
1055
|
-
/**
|
1056
|
-
* Condition to start listening to events at instance creation.
|
1057
|
-
*/
|
1058
|
-
autorun?: boolean;
|
1059
|
-
/**
|
1060
|
-
* Last event Id. If provided it is possible to continue
|
1061
|
-
* consuming events from a known Id instead of from the last
|
1062
|
-
* produced event.
|
1063
|
-
*/
|
1064
|
-
lastEventId?: string;
|
1065
|
-
/**
|
1066
|
-
* Timeout for the blocking XREAD call to the events stream.
|
1067
|
-
*/
|
1068
|
-
blockingTimeout?: number;
|
1069
|
-
}
|
1070
|
-
|
1071
|
-
export declare class QueueGetters extends QueueBase {
|
1072
|
-
getJob(jobId: string): Promise<Job | undefined>;
|
1073
|
-
private commandByType;
|
1074
|
-
/**
|
1075
|
-
Returns the number of jobs waiting to be processed.
|
1076
|
-
*/
|
1077
|
-
count(): Promise<number>;
|
1078
|
-
/**
|
1079
|
-
* Job counts by type
|
1080
|
-
*
|
1081
|
-
* Queue#getJobCountByTypes('completed') => completed count
|
1082
|
-
* Queue#getJobCountByTypes('completed,failed') => completed + failed count
|
1083
|
-
* Queue#getJobCountByTypes('completed', 'failed') => completed + failed count
|
1084
|
-
* Queue#getJobCountByTypes('completed', 'waiting', 'failed') => completed + waiting + failed count
|
1085
|
-
*/
|
1086
|
-
getJobCountByTypes(...types: string[]): Promise<number>;
|
1087
|
-
/**
|
1088
|
-
* Returns the job counts for each type specified or every list/set in the queue by default.
|
1089
|
-
*
|
1090
|
-
* @returns An object, key (type) and value (count)
|
1091
|
-
*/
|
1092
|
-
getJobCounts(...types: string[]): Promise<{
|
1093
|
-
[index: string]: number;
|
1094
|
-
}>;
|
1095
|
-
getCompletedCount(): Promise<number>;
|
1096
|
-
getFailedCount(): Promise<number>;
|
1097
|
-
getDelayedCount(): Promise<number>;
|
1098
|
-
getActiveCount(): Promise<number>;
|
1099
|
-
getWaitingCount(): Promise<number>;
|
1100
|
-
getWaitingChildrenCount(): Promise<number>;
|
1101
|
-
getWaiting(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1102
|
-
getWaitingChildren(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1103
|
-
getActive(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1104
|
-
getDelayed(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1105
|
-
getCompleted(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1106
|
-
getFailed(start?: number, end?: number): Promise<Job<any, any, string>[]>;
|
1107
|
-
getRanges(types: string[], start?: number, end?: number, asc?: boolean): Promise<any[]>;
|
1108
|
-
getJobs(types: string[] | string, start?: number, end?: number, asc?: boolean): Promise<Job<any, any, string>[]>;
|
1109
|
-
getJobLogs(jobId: string, start?: number, end?: number, asc?: boolean): Promise<{
|
1110
|
-
logs: [string];
|
1111
|
-
count: number;
|
1112
|
-
}>;
|
1113
|
-
/**
|
1114
|
-
* Get worker list related to the queue.
|
1115
|
-
*
|
1116
|
-
* @returns - Returns an array with workers info.
|
1117
|
-
*/
|
1118
|
-
getWorkers(): Promise<{
|
1119
|
-
[index: string]: string;
|
1120
|
-
}[]>;
|
1121
|
-
private parseClientList;
|
1122
|
-
}
|
1123
|
-
|
1124
|
-
declare class QueueKeys {
|
1125
|
-
readonly prefix: string;
|
1126
|
-
constructor(prefix?: string);
|
1127
|
-
getKeys(name: string): KeysMap;
|
1128
|
-
toKey(name: string, type: string): string;
|
1129
|
-
getPrefixedQueueName(name: string): string;
|
1130
|
-
}
|
1131
|
-
|
1132
|
-
/**
|
1133
|
-
* Options for the Queue class.
|
1134
|
-
*/
|
1135
|
-
export declare interface QueueOptions extends QueueBaseOptions {
|
1136
|
-
defaultJobOptions?: JobsOptions;
|
1137
|
-
/**
|
1138
|
-
* Options for the rate limiter.
|
1139
|
-
*/
|
1140
|
-
limiter?: {
|
1141
|
-
/**
|
1142
|
-
* Group key to be used by the limiter when
|
1143
|
-
* limiting by group keys.
|
1144
|
-
*/
|
1145
|
-
groupKey: string;
|
1146
|
-
};
|
1147
|
-
/**
|
1148
|
-
* Options for the streams used internally in BullMQ.
|
1149
|
-
*/
|
1150
|
-
streams?: {
|
1151
|
-
/**
|
1152
|
-
* Options for the events stream.
|
1153
|
-
*/
|
1154
|
-
events: {
|
1155
|
-
/**
|
1156
|
-
* Max approximated length for streams. Default is 10 000 events.
|
1157
|
-
*/
|
1158
|
-
maxLen: number;
|
1159
|
-
};
|
1160
|
-
};
|
1161
|
-
}
|
1162
|
-
|
1163
|
-
/**
|
1164
|
-
* This class is just used for some automatic bookkeeping of the queue,
|
1165
|
-
* such as updating the delay set as well as moving stalled jobs back
|
1166
|
-
* to the waiting list.
|
1167
|
-
*
|
1168
|
-
* Jobs are checked for stallness once every "visibility window" seconds.
|
1169
|
-
* Jobs are then marked as candidates for being stalled, in the next check,
|
1170
|
-
* the candidates are marked as stalled and moved to wait.
|
1171
|
-
* Workers need to clean the candidate list with the jobs that they are working
|
1172
|
-
* on, failing to update the list results in the job ending being stalled.
|
1173
|
-
*
|
1174
|
-
* This class requires a dedicated redis connection, and at least one is needed
|
1175
|
-
* to be running at a given time, otherwise delays, stalled jobs, retries, repeatable
|
1176
|
-
* jobs, etc, will not work correctly or at all.
|
1177
|
-
*
|
1178
|
-
*/
|
1179
|
-
export declare class QueueScheduler extends QueueBase implements QueueSchedulerDeclaration {
|
1180
|
-
private nextTimestamp;
|
1181
|
-
private isBlocked;
|
1182
|
-
private running;
|
1183
|
-
constructor(name: string, { connection, autorun, ...opts }?: QueueSchedulerOptions);
|
1184
|
-
run(): Promise<void>;
|
1185
|
-
isRunning(): boolean;
|
1186
|
-
private readDelayedData;
|
1187
|
-
private updateDelaySet;
|
1188
|
-
private moveStalledJobsToWait;
|
1189
|
-
close(): Promise<void>;
|
1190
|
-
}
|
1191
|
-
|
1192
|
-
export declare interface QueueSchedulerDeclaration {
|
1193
|
-
on(event: 'stalled', listener: (jobId: string, prev: string) => void): this;
|
1194
|
-
on(event: 'failed', listener: (jobId: string, failedReason: Error, prev: string) => void): this;
|
1195
|
-
on(event: string, listener: Function): this;
|
1196
|
-
}
|
1197
|
-
|
1198
|
-
/**
|
1199
|
-
* Options for customizing the behaviour of the scheduler.
|
1200
|
-
*
|
1201
|
-
* @see {@link https://docs.bullmq.io/guide/jobs/stalled}
|
1202
|
-
* @see {@link https://docs.bullmq.io/guide/queuescheduler}
|
1203
|
-
*/
|
1204
|
-
export declare interface QueueSchedulerOptions extends QueueBaseOptions {
|
1205
|
-
/**
|
1206
|
-
* Condition to start scheduler at instance creation.
|
1207
|
-
*/
|
1208
|
-
autorun?: boolean;
|
1209
|
-
/**
|
1210
|
-
* Amount of times a job can be recovered from a stalled state
|
1211
|
-
* to the `wait` state. If this is exceeded, the job is moved
|
1212
|
-
* to `failed`.
|
1213
|
-
*/
|
1214
|
-
maxStalledCount?: number;
|
1215
|
-
/**
|
1216
|
-
* Number of milliseconds between stallness checks.
|
1217
|
-
*/
|
1218
|
-
stalledInterval?: number;
|
1219
|
-
}
|
1220
|
-
|
1221
|
-
export declare interface RateLimiterOptions {
|
1222
|
-
/**
|
1223
|
-
* Max number of jobs to process in the time period
|
1224
|
-
* specified in `duration`.
|
1225
|
-
*/
|
1226
|
-
max: number;
|
1227
|
-
/**
|
1228
|
-
* Time in milliseconds. During this time, a maximum
|
1229
|
-
* of `max` jobs will be processed.
|
1230
|
-
*/
|
1231
|
-
duration: number;
|
1232
|
-
/**
|
1233
|
-
* It is possible to define a rate limiter based on group keys,
|
1234
|
-
* for example you may want to have a rate limiter per customer
|
1235
|
-
* instead of a global rate limiter for all customers
|
1236
|
-
*
|
1237
|
-
* @see {@link https://docs.bullmq.io/guide/rate-limiting}
|
1238
|
-
*/
|
1239
|
-
groupKey?: string;
|
1240
|
-
/**
|
1241
|
-
* This option enables a heuristic so that when a queue is heavily
|
1242
|
-
* rete limited, it delays the workers so that they do not try
|
1243
|
-
* to pick jobs when there is no point in doing so.
|
1244
|
-
* Note: It is not recommended to use this option when using
|
1245
|
-
* groupKeys unless you have a big amount of workers since
|
1246
|
-
* you may be delaying workers that could pick jobs in groups that
|
1247
|
-
* have not been rate limited.
|
1248
|
-
*/
|
1249
|
-
workerDelay?: boolean;
|
1250
|
-
}
|
1251
|
-
|
1252
|
-
export declare type RedisClient = Redis | Cluster;
|
1253
|
-
|
1254
|
-
export declare class RedisConnection extends EventEmitter {
|
1255
|
-
private readonly opts?;
|
1256
|
-
private readonly shared;
|
1257
|
-
static minimumVersion: string;
|
1258
|
-
protected _client: RedisClient;
|
1259
|
-
private initializing;
|
1260
|
-
private closing;
|
1261
|
-
private version;
|
1262
|
-
private handleClientError;
|
1263
|
-
constructor(opts?: ConnectionOptions, shared?: boolean);
|
1264
|
-
private checkOptions;
|
1265
|
-
/**
|
1266
|
-
* Waits for a redis client to be ready.
|
1267
|
-
* @param redis - client
|
1268
|
-
*/
|
1269
|
-
static waitUntilReady(client: RedisClient): Promise<void>;
|
1270
|
-
get client(): Promise<RedisClient>;
|
1271
|
-
protected loadCommands(): Promise<void>;
|
1272
|
-
private init;
|
1273
|
-
disconnect(): Promise<void>;
|
1274
|
-
reconnect(): Promise<void>;
|
1275
|
-
close(): Promise<void>;
|
1276
|
-
private getRedisVersion;
|
1277
|
-
get redisVersion(): string;
|
1278
|
-
}
|
1279
|
-
|
1280
|
-
export declare type RedisOptions = RedisOptions_2 & {
|
1281
|
-
skipVersionCheck?: boolean;
|
1282
|
-
};
|
1283
|
-
|
1284
|
-
export declare function removeAllQueueData(client: RedisClient, queueName: string, prefix?: string): Promise<void | boolean>;
|
1285
|
-
|
1286
|
-
export declare class Repeat extends QueueBase {
|
1287
|
-
addNextRepeatableJob<T = any, R = any, N extends string = string>(name: N, data: T, opts: JobsOptions, skipCheckExists?: boolean): Promise<Job<T, R, N>>;
|
1288
|
-
private createNextJob;
|
1289
|
-
removeRepeatable(name: string, repeat: RepeatOptions, jobId?: string): Promise<any>;
|
1290
|
-
removeRepeatableByKey(repeatJobKey: string): Promise<any>;
|
1291
|
-
private keyToData;
|
1292
|
-
getRepeatableJobs(start?: number, end?: number, asc?: boolean): Promise<{
|
1293
|
-
key: string;
|
1294
|
-
name: string;
|
1295
|
-
id: string;
|
1296
|
-
endDate: number;
|
1297
|
-
tz: string;
|
1298
|
-
cron: string;
|
1299
|
-
next: number;
|
1300
|
-
}[]>;
|
1301
|
-
getRepeatableCount(): Promise<number>;
|
1302
|
-
}
|
1303
|
-
|
1304
|
-
/**
|
1305
|
-
* Settings for repeatable jobs
|
1306
|
-
*
|
1307
|
-
* @see {@link https://docs.bullmq.io/guide/jobs/repeatable}
|
1308
|
-
*/
|
1309
|
-
export declare interface RepeatOptions {
|
1310
|
-
/**
|
1311
|
-
* A cron pattern
|
1312
|
-
*/
|
1313
|
-
cron?: string;
|
1314
|
-
/**
|
1315
|
-
* Timezone
|
1316
|
-
*/
|
1317
|
-
tz?: string;
|
1318
|
-
/**
|
1319
|
-
* Start date when the repeat job should start repeating (only with `cron`).
|
1320
|
-
*/
|
1321
|
-
startDate?: Date | string | number;
|
1322
|
-
/**
|
1323
|
-
* End date when the repeat job should stop repeating.
|
1324
|
-
*/
|
1325
|
-
endDate?: Date | string | number;
|
1326
|
-
/**
|
1327
|
-
* Number of times the job should repeat at max.
|
1328
|
-
*/
|
1329
|
-
limit?: number;
|
1330
|
-
/**
|
1331
|
-
* Repeat after this amount of milliseconds
|
1332
|
-
* (`cron` setting cannot be used together with this setting.)
|
1333
|
-
*/
|
1334
|
-
every?: number;
|
1335
|
-
/**
|
1336
|
-
* Repeated job should start right now
|
1337
|
-
* ( work only with every settings)
|
1338
|
-
*/
|
1339
|
-
immediately?: boolean;
|
1340
|
-
/**
|
1341
|
-
* The start value for the repeat iteration count.
|
1342
|
-
*/
|
1343
|
-
count?: number;
|
1344
|
-
prevMillis?: number;
|
1345
|
-
offset?: number;
|
1346
|
-
jobId?: string;
|
1347
|
-
}
|
1348
|
-
|
1349
|
-
/**
|
1350
|
-
* @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
|
1351
|
-
*/
|
1352
|
-
export declare interface SandboxedJob<T = any, R = any> extends Omit<JobJson, 'data' | 'opts' | 'progress' | 'returnValue'> {
|
1353
|
-
data: T;
|
1354
|
-
opts: JobsOptions;
|
1355
|
-
progress: (() => object | number) | ((value: object | number) => Promise<void>);
|
1356
|
-
updateProgress: (value: object | number) => Promise<void>;
|
1357
|
-
log: (row: any) => void;
|
1358
|
-
returnValue: R;
|
1359
|
-
}
|
1360
|
-
|
1361
|
-
/**
|
1362
|
-
* @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
|
1363
|
-
*/
|
1364
|
-
export declare type SandboxedJobProcessor<T = any, R = any> = ((job: SandboxedJob<T, R>) => R | PromiseLike<R>) | ((job: SandboxedJob<T, R>, callback: (error: unknown, result: R) => void) => void);
|
1365
|
-
|
1366
|
-
export declare class Scripts {
|
1367
|
-
static isJobInList(queue: MinimalQueue, listKey: string, jobId: string): Promise<boolean>;
|
1368
|
-
static addJob(client: RedisClient, queue: MinimalQueue, job: JobJson, opts: JobsOptions, jobId: string, parentOpts?: ParentOpts): Promise<string>;
|
1369
|
-
static pause(queue: MinimalQueue, pause: boolean): Promise<any>;
|
1370
|
-
static remove(queue: MinimalQueue, jobId: string): Promise<number>;
|
1371
|
-
static extendLock(queue: MinimalQueue, jobId: string, token: string, duration: number): Promise<number>;
|
1372
|
-
static updateProgress(queue: MinimalQueue, job: Job, progress: number | object): Promise<void>;
|
1373
|
-
static moveToFinishedArgs(queue: MinimalQueue, job: Job, val: any, propVal: string, shouldRemove: boolean | number, target: string, token: string, fetchNext?: boolean): string[];
|
1374
|
-
static moveToFinished(queue: MinimalQueue, job: Job, val: any, propVal: string, shouldRemove: boolean | number, target: string, token: string, fetchNext: boolean): Promise<[JobJsonRaw, string] | []>;
|
1375
|
-
static finishedErrors(code: number, jobId: string, command: string, state?: string): Error;
|
1376
|
-
static drainArgs(queue: MinimalQueue, delayed: boolean): string[];
|
1377
|
-
static drain(queue: MinimalQueue, delayed: boolean): Promise<void>;
|
1378
|
-
static moveToCompleted(queue: MinimalQueue, job: Job, returnvalue: any, removeOnComplete: boolean | number, token: string, fetchNext: boolean): Promise<[JobJsonRaw, string] | []>;
|
1379
|
-
static moveToFailedArgs(queue: MinimalQueue, job: Job, failedReason: string, removeOnFailed: boolean | number, token: string, fetchNext?: boolean): string[];
|
1380
|
-
static isFinished(queue: MinimalQueue, jobId: string, returnValue?: boolean): Promise<number | [number, string]>;
|
1381
|
-
static getState(queue: MinimalQueue, jobId: string): Promise<string>;
|
1382
|
-
static changeDelay(queue: MinimalQueue, jobId: string, delay: number): Promise<void>;
|
1383
|
-
static changeDelayArgs(queue: MinimalQueue, jobId: string, timestamp: number): string[];
|
1384
|
-
static moveToDelayedArgs(queue: MinimalQueue, jobId: string, timestamp: number): string[];
|
1385
|
-
static moveToWaitingChildrenArgs(queue: MinimalQueue, jobId: string, token: string, opts?: MoveToChildrenOpts): string[];
|
1386
|
-
static moveToDelayed(queue: MinimalQueue, jobId: string, timestamp: number): Promise<void>;
|
1387
|
-
/**
|
1388
|
-
* Move parent job to waiting-children state.
|
1389
|
-
*
|
1390
|
-
* @returns true if job is successfully moved, false if there are pending dependencies.
|
1391
|
-
* @throws JobNotExist
|
1392
|
-
* This exception is thrown if jobId is missing.
|
1393
|
-
* @throws JobLockNotExist
|
1394
|
-
* This exception is thrown if job lock is missing.
|
1395
|
-
* @throws JobNotInState
|
1396
|
-
* This exception is thrown if job is not in active state.
|
1397
|
-
*/
|
1398
|
-
static moveToWaitingChildren(queue: MinimalQueue, jobId: string, token: string, opts?: MoveToChildrenOpts): Promise<boolean>;
|
1399
|
-
/**
|
1400
|
-
* Remove jobs in a specific state.
|
1401
|
-
*
|
1402
|
-
* @returns Id jobs from the deleted records.
|
1403
|
-
*/
|
1404
|
-
static cleanJobsInSet(queue: MinimalQueue, set: string, timestamp: number, limit?: number): Promise<string[]>;
|
1405
|
-
static retryJobArgs(queue: MinimalQueue, job: Job): string[];
|
1406
|
-
/**
|
1407
|
-
* Attempts to reprocess a job
|
1408
|
-
*
|
1409
|
-
* @param job -
|
1410
|
-
* @param {Object} options
|
1411
|
-
* @param {String} options.state The expected job state. If the job is not found
|
1412
|
-
* on the provided state, then it's not reprocessed. Supported states: 'failed', 'completed'
|
1413
|
-
*
|
1414
|
-
* @returns Returns a promise that evaluates to a return code:
|
1415
|
-
* 1 means the operation was a success
|
1416
|
-
* 0 means the job does not exist
|
1417
|
-
* -1 means the job is currently locked and can't be retried.
|
1418
|
-
* -2 means the job was not found in the expected set
|
1419
|
-
*/
|
1420
|
-
static reprocessJob(queue: MinimalQueue, job: Job, state: 'failed' | 'completed'): Promise<void>;
|
1421
|
-
static moveToActive<T, R, N extends string>(worker: Worker_2<T, R, N>, token: string, jobId?: string): Promise<[] | [number, undefined] | [JobJsonRaw, string]>;
|
1422
|
-
static updateDelaySet(queue: MinimalQueue, delayedTimestamp: number): Promise<any>;
|
1423
|
-
static promote(queue: MinimalQueue, jobId: string): Promise<any>;
|
1424
|
-
static moveStalledJobsToWait(queue: QueueScheduler): Promise<any>;
|
1425
|
-
static obliterate(queue: MinimalQueue, opts: {
|
1426
|
-
force: boolean;
|
1427
|
-
count: number;
|
1428
|
-
}): Promise<any>;
|
1429
|
-
}
|
1430
|
-
|
1431
|
-
export declare interface Strategies {
|
1432
|
-
[index: string]: BackoffFunction;
|
1433
|
-
}
|
1434
|
-
|
1435
|
-
export declare function tryCatch(fn: (...args: any) => any, ctx: any, args: any[]): any;
|
1436
|
-
|
1437
|
-
/**
|
1438
|
-
*
|
1439
|
-
* This class represents a worker that is able to process jobs from the queue.
|
1440
|
-
* As soon as the class is instantiated it will start processing jobs.
|
1441
|
-
*
|
1442
|
-
*/
|
1443
|
-
declare class Worker_2<DataType = any, ResultType = any, NameType extends string = string> extends QueueBase implements WorkerDeclaration {
|
1444
|
-
opts: WorkerOptions_2;
|
1445
|
-
private drained;
|
1446
|
-
private waiting;
|
1447
|
-
private running;
|
1448
|
-
private processFn;
|
1449
|
-
private resumeWorker;
|
1450
|
-
private paused;
|
1451
|
-
private _repeat;
|
1452
|
-
private childPool;
|
1453
|
-
private timerManager;
|
1454
|
-
private blockingConnection;
|
1455
|
-
private processing;
|
1456
|
-
constructor(name: string, processor?: string | Processor<DataType, ResultType, NameType>, opts?: WorkerOptions_2, Connection?: typeof RedisConnection);
|
1457
|
-
/**
|
1458
|
-
*
|
1459
|
-
* Waits until the worker is ready to start processing jobs.
|
1460
|
-
* In general only useful when writing tests.
|
1461
|
-
*
|
1462
|
-
*/
|
1463
|
-
waitUntilReady(): Promise<RedisClient>;
|
1464
|
-
get repeat(): Promise<Repeat>;
|
1465
|
-
run(): Promise<any[]>;
|
1466
|
-
/**
|
1467
|
-
* Returns a promise that resolves to the next job in queue.
|
1468
|
-
* @param token - worker token to be assigned to retrieved job
|
1469
|
-
* @returns a Job or undefined if no job was available in the queue.
|
1470
|
-
*/
|
1471
|
-
getNextJob(token: string, { block }?: GetNextJobOptions): Promise<Job<any, any, string>>;
|
1472
|
-
private moveToActive;
|
1473
|
-
private waitForJob;
|
1474
|
-
/**
|
1475
|
-
*
|
1476
|
-
* This function is exposed only for testing purposes.
|
1477
|
-
*/
|
1478
|
-
delay(): Promise<void>;
|
1479
|
-
private nextJobFromJobData;
|
1480
|
-
processJob(job: Job<DataType, ResultType, NameType>, token: string): Promise<void | Job<any, any, string>>;
|
1481
|
-
/**
|
1482
|
-
*
|
1483
|
-
* Pauses the processing of this queue only for this worker.
|
1484
|
-
*/
|
1485
|
-
pause(doNotWaitActive?: boolean): Promise<void>;
|
1486
|
-
/**
|
1487
|
-
*
|
1488
|
-
* Resumes processing of this worker (if paused).
|
1489
|
-
*/
|
1490
|
-
resume(): void;
|
1491
|
-
/**
|
1492
|
-
*
|
1493
|
-
* Checks if worker is paused.
|
1494
|
-
*
|
1495
|
-
* @returns true if worker is paused, false otherwise.
|
1496
|
-
*/
|
1497
|
-
isPaused(): boolean;
|
1498
|
-
/**
|
1499
|
-
*
|
1500
|
-
* Checks if worker is currently running.
|
1501
|
-
*
|
1502
|
-
* @returns true if worker is running, false otherwise.
|
1503
|
-
*/
|
1504
|
-
isRunning(): boolean;
|
1505
|
-
/**
|
1506
|
-
*
|
1507
|
-
* Closes the worker and related redis connections.
|
1508
|
-
*
|
1509
|
-
* This method waits for current jobs to finalize before returning.
|
1510
|
-
*
|
1511
|
-
* @param force - Use force boolean parameter if you do not want to wait for
|
1512
|
-
* current jobs to be processed.
|
1513
|
-
*
|
1514
|
-
* @returns Promise that resolves when the worker has been closed.
|
1515
|
-
*/
|
1516
|
-
close(force?: boolean): Promise<void>;
|
1517
|
-
/**
|
1518
|
-
* Returns a promise that resolves when active jobs are cleared
|
1519
|
-
*
|
1520
|
-
* @returns
|
1521
|
-
*/
|
1522
|
-
private whenCurrentJobsFinished;
|
1523
|
-
private retryIfFailed;
|
1524
|
-
}
|
1525
|
-
export { Worker_2 as Worker }
|
1526
|
-
|
1527
|
-
export declare interface WorkerDeclaration {
|
1528
|
-
on(event: 'active', listener: (job: Job, prev: string) => void): this;
|
1529
|
-
on(event: 'completed', listener: (job: Job) => void): this;
|
1530
|
-
on(event: 'drained', listener: () => void): this;
|
1531
|
-
on(event: 'error', listener: (failedReason: Error) => void): this;
|
1532
|
-
on(event: 'failed', listener: (job: Job, error: Error) => void): this;
|
1533
|
-
on(event: 'progress', listener: (job: Job, progress: number | object) => void): this;
|
1534
|
-
on(event: string, listener: Function): this;
|
1535
|
-
}
|
1536
|
-
|
1537
|
-
declare interface WorkerOptions_2 extends QueueBaseOptions {
|
1538
|
-
/**
|
1539
|
-
* Condition to start processor at instance creation.
|
1540
|
-
*/
|
1541
|
-
autorun?: boolean;
|
1542
|
-
/**
|
1543
|
-
* Amount of jobs that a single worker is allowed to work on
|
1544
|
-
* in parallel.
|
1545
|
-
*
|
1546
|
-
* @see {@link https://docs.bullmq.io/guide/workers/concurrency}
|
1547
|
-
*/
|
1548
|
-
concurrency?: number;
|
1549
|
-
/**
|
1550
|
-
* @see {@link https://docs.bullmq.io/guide/rate-limiting}
|
1551
|
-
*/
|
1552
|
-
limiter?: RateLimiterOptions;
|
1553
|
-
skipDelayCheck?: boolean;
|
1554
|
-
drainDelay?: number;
|
1555
|
-
lockDuration?: number;
|
1556
|
-
lockRenewTime?: number;
|
1557
|
-
runRetryDelay?: number;
|
1558
|
-
settings?: AdvancedOptions;
|
1559
|
-
}
|
1560
|
-
export { WorkerOptions_2 as WorkerOptions }
|
1561
|
-
|
1562
|
-
export { }
|