@oneuptime/common 7.0.5045 → 7.0.5049
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.
|
@@ -14,7 +14,20 @@ export default class QueueWorker {
|
|
|
14
14
|
public static getWorker(
|
|
15
15
|
queueName: QueueName,
|
|
16
16
|
onJobInQueue: (job: QueueJob) => Promise<void>,
|
|
17
|
-
options: {
|
|
17
|
+
options: {
|
|
18
|
+
concurrency: number;
|
|
19
|
+
/**
|
|
20
|
+
* How long (in ms) the worker will hold a lock on the job before it's considered stalled
|
|
21
|
+
* if the event loop is blocked and the lock cannot be extended in time.
|
|
22
|
+
* Defaults to BullMQ default (30s) if not provided.
|
|
23
|
+
*/
|
|
24
|
+
lockDuration?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum number of times a job can be re-processed due to stall detection
|
|
27
|
+
* before being moved to failed. Defaults to BullMQ default (1) if not provided.
|
|
28
|
+
*/
|
|
29
|
+
maxStalledCount?: number;
|
|
30
|
+
},
|
|
18
31
|
): Worker {
|
|
19
32
|
const worker: Worker = new Worker(queueName, onJobInQueue, {
|
|
20
33
|
connection: {
|
|
@@ -23,6 +36,11 @@ export default class QueueWorker {
|
|
|
23
36
|
password: RedisPassword,
|
|
24
37
|
},
|
|
25
38
|
concurrency: options.concurrency,
|
|
39
|
+
// Only set these values if provided so we do not override BullMQ defaults
|
|
40
|
+
...(options.lockDuration ? { lockDuration: options.lockDuration } : {}),
|
|
41
|
+
...(options.maxStalledCount !== undefined
|
|
42
|
+
? { maxStalledCount: options.maxStalledCount }
|
|
43
|
+
: {}),
|
|
26
44
|
});
|
|
27
45
|
|
|
28
46
|
process.on("SIGINT", async () => {
|
package/UI/Utils/API/API.ts
CHANGED
|
@@ -14,14 +14,13 @@ import { Worker } from "bullmq";
|
|
|
14
14
|
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
|
|
15
15
|
export default class QueueWorker {
|
|
16
16
|
static getWorker(queueName, onJobInQueue, options) {
|
|
17
|
-
const worker = new Worker(queueName, onJobInQueue, {
|
|
18
|
-
connection: {
|
|
17
|
+
const worker = new Worker(queueName, onJobInQueue, Object.assign(Object.assign({ connection: {
|
|
19
18
|
host: RedisHostname.toString(),
|
|
20
19
|
port: RedisPort.toNumber(),
|
|
21
20
|
password: RedisPassword,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
}, concurrency: options.concurrency }, (options.lockDuration ? { lockDuration: options.lockDuration } : {})), (options.maxStalledCount !== undefined
|
|
22
|
+
? { maxStalledCount: options.maxStalledCount }
|
|
23
|
+
: {})));
|
|
25
24
|
process.on("SIGINT", async () => {
|
|
26
25
|
await worker.close();
|
|
27
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueueWorker.js","sourceRoot":"","sources":["../../../../Server/Infrastructure/QueueWorker.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AAMtE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,WAAW,MAAM,gCAAgC,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,WAAW;IAEhB,AAAP,MAAM,CAAC,SAAS,CACrB,SAAoB,EACpB,YAA8C,EAC9C,
|
|
1
|
+
{"version":3,"file":"QueueWorker.js","sourceRoot":"","sources":["../../../../Server/Infrastructure/QueueWorker.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AAMtE,OAAO,EAAE,MAAM,EAAE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