-
Notifications
You must be signed in to change notification settings - Fork 414
/
base-job-options.ts
110 lines (94 loc) · 2.8 KB
/
base-job-options.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { RepeatOptions, KeepJobs, BackoffOptions } from './';
export interface DefaultJobOptions {
/**
* Timestamp when the job was created.
* @defaultValue Date.now()
*/
timestamp?: number;
/**
* Ranges from 1 (highest priority) to MAX_INT (lowest priority). Note that
* using priorities has a slight impact on performance,
* so do not use it if not required.
*/
priority?: number;
/**
* An amount of milliseconds to wait until this job can be processed.
* Note that for accurate delays, worker and producers
* should have their clocks synchronized.
* @defaultValue 0
*/
delay?: number;
/**
* The total number of attempts to try the job until it completes.
* @defaultValue 0
*/
attempts?: number;
/**
* Rate limiter key to use if rate limiter enabled.
*
* @see {@link https://docs.bullmq.io/guide/rate-limiting}
*/
rateLimiterKey?: string;
/**
* Backoff setting for automatic retries if the job fails
*/
backoff?: number | BackoffOptions;
/**
* If true, adds the job to the right of the queue instead of the left (default false)
*
* @see {@link https://docs.bullmq.io/guide/jobs/lifo}
*/
lifo?: boolean;
/**
* If true, removes the job when it successfully completes
* When given an number, it specifies the maximum amount of
* jobs to keep, or you can provide an object specifying max
* age and/or count to keep.
* Default behavior is to keep the job in the completed set.
*/
removeOnComplete?: boolean | number | KeepJobs;
/**
* If true, removes the job when it fails after all attempts.
* When given an number, it specifies the maximum amount of
* jobs to keep, or you can provide an object specifying max
* age and/or count to keep.
*/
removeOnFail?: boolean | number | KeepJobs;
/**
* Limits the amount of stack trace lines that will be recorded in the stacktrace.
*/
stackTraceLimit?: number;
/**
* Limits the size in bytes of the job's data payload (as a JSON serialized string).
*/
sizeLimit?: number;
}
export interface BaseJobOptions extends DefaultJobOptions {
/**
* Repeat this job, for example based on a `cron` schedule.
*/
repeat?: RepeatOptions;
/**
* Internal property used by repeatable jobs to save base repeat job key.
*/
repeatJobKey?: string;
/**
* Override the job ID - by default, the job ID is a unique
* integer, but you can use this setting to override it.
* If you use this option, it is up to you to ensure the
* jobId is unique. If you attempt to add a job with an id that
* already exists, it will not be added.
*/
jobId?: string;
/**
*
*/
parent?: {
id: string;
queue: string; // Queue name including prefix
};
/**
* Internal property used by repeatable jobs.
*/
prevMillis?: number;
}