@sidequest/engine 1.7.0 → 1.8.0
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/engine.cjs +3 -0
- package/dist/engine.cjs.map +1 -1
- package/dist/engine.js +3 -0
- package/dist/engine.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/job/constants.cjs +2 -0
- package/dist/job/constants.cjs.map +1 -1
- package/dist/job/constants.js +2 -0
- package/dist/job/constants.js.map +1 -1
- package/dist/job/cron-registry.cjs +86 -0
- package/dist/job/cron-registry.cjs.map +1 -0
- package/dist/job/cron-registry.d.ts +39 -0
- package/dist/job/cron-registry.js +84 -0
- package/dist/job/cron-registry.js.map +1 -0
- package/dist/job/job-builder.cjs +38 -3
- package/dist/job/job-builder.cjs.map +1 -1
- package/dist/job/job-builder.d.ts +40 -15
- package/dist/job/job-builder.js +38 -3
- package/dist/job/job-builder.js.map +1 -1
- package/package.json +6 -6
package/dist/engine.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var os = require('os');
|
|
|
7
7
|
var util = require('util');
|
|
8
8
|
var constants$1 = require('./constants.cjs');
|
|
9
9
|
var constants = require('./job/constants.cjs');
|
|
10
|
+
var cronRegistry = require('./job/cron-registry.cjs');
|
|
10
11
|
var jobBuilder = require('./job/job-builder.cjs');
|
|
11
12
|
var grantQueueConfig = require('./queue/grant-queue-config.cjs');
|
|
12
13
|
var shutdown = require('./utils/shutdown.cjs');
|
|
@@ -162,6 +163,8 @@ class Engine {
|
|
|
162
163
|
if (!this.shuttingDown) {
|
|
163
164
|
this.shuttingDown = true;
|
|
164
165
|
core.logger("Engine").debug("Closing Sidequest engine...");
|
|
166
|
+
// Stop all scheduled cron jobs first
|
|
167
|
+
await cronRegistry.ScheduledJobRegistry.stopAll();
|
|
165
168
|
if (this.mainWorker) {
|
|
166
169
|
const promise = new Promise((resolve) => {
|
|
167
170
|
this.mainWorker.on("exit", resolve);
|
package/dist/engine.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.cjs","sources":["../src/engine.ts"],"sourcesContent":[null],"names":["logger","cpus","MISC_FALLBACK","JOB_BUILDER_FALLBACK","QUEUE_FALLBACK","inspect","configureLogger","LazyBackend","grantQueueConfig","fork","DEFAULT_WORKER_PATH","gracefulShutdown","clearGracefulShutdown","JobBuilder"],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.cjs","sources":["../src/engine.ts"],"sourcesContent":[null],"names":["logger","cpus","MISC_FALLBACK","JOB_BUILDER_FALLBACK","QUEUE_FALLBACK","inspect","configureLogger","LazyBackend","grantQueueConfig","fork","DEFAULT_WORKER_PATH","gracefulShutdown","ScheduledJobRegistry","clearGracefulShutdown","JobBuilder"],"mappings":";;;;;;;;;;;;;;AAqFA;;AAEG;MACU,MAAM,CAAA;AACjB;;;AAGG;AACK,IAAA,OAAO;AAEf;;;;AAIG;AACK,IAAA,MAAM;AAEd;;;AAGG;AACK,IAAA,UAAU;AAElB;;;AAGG;IACK,YAAY,GAAG,KAAK;AAE5B;;;;AAIG;IACH,MAAM,SAAS,CAAC,MAAqB,EAAA;AACnC,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;YACfA,WAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC;YACtD,OAAO,IAAI,CAAC,MAAM;QACpB;QACA,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;AAC5B,YAAA,OAAO,EAAE;AACP,gBAAA,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,2BAA2B;AAC9D,gBAAA,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,oBAAoB;AACxD,aAAA;AACD,YAAA,8BAA8B,EAAE,MAAM,EAAE,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 import { cpus } from 'os';
|
|
|
5
5
|
import { inspect } from 'util';
|
|
6
6
|
import { DEFAULT_WORKER_PATH } from './constants.js';
|
|
7
7
|
import { JOB_BUILDER_FALLBACK } from './job/constants.js';
|
|
8
|
+
import { ScheduledJobRegistry } from './job/cron-registry.js';
|
|
8
9
|
import { JobBuilder } from './job/job-builder.js';
|
|
9
10
|
import { grantQueueConfig } from './queue/grant-queue-config.js';
|
|
10
11
|
import { gracefulShutdown, clearGracefulShutdown } from './utils/shutdown.js';
|
|
@@ -160,6 +161,8 @@ class Engine {
|
|
|
160
161
|
if (!this.shuttingDown) {
|
|
161
162
|
this.shuttingDown = true;
|
|
162
163
|
logger("Engine").debug("Closing Sidequest engine...");
|
|
164
|
+
// Stop all scheduled cron jobs first
|
|
165
|
+
await ScheduledJobRegistry.stopAll();
|
|
163
166
|
if (this.mainWorker) {
|
|
164
167
|
const promise = new Promise((resolve) => {
|
|
165
168
|
this.mainWorker.on("exit", resolve);
|
package/dist/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sources":["../src/engine.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.js","sources":["../src/engine.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAqFA;;AAEG;MACU,MAAM,CAAA;AACjB;;;AAGG;AACK,IAAA,OAAO;AAEf;;;;AAIG;AACK,IAAA,MAAM;AAEd;;;AAGG;AACK,IAAA,UAAU;AAElB;;;AAGG;IACK,YAAY,GAAG,KAAK;AAE5B;;;;AAIG;IACH,MAAM,SAAS,CAAC,MAAqB,EAAA;AACnC,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC;YACtD,OAAO,IAAI,CAAC,MAAM;QACpB;QACA,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,MAAM,EAAE,MAAM,EAAE,MAA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AAC,MAAM,CAAC,WAAW,CAAC,WAAW,IAAI,oBAAoB,CAAC,WAAY;AACtF,SAAA,EACD,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAChC;IACH;AACD;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ var dispatcher = require('./execution/dispatcher.cjs');
|
|
|
6
6
|
var executorManager = require('./execution/executor-manager.cjs');
|
|
7
7
|
var queueManager = require('./execution/queue-manager.cjs');
|
|
8
8
|
var constants$1 = require('./job/constants.cjs');
|
|
9
|
+
var cronRegistry = require('./job/cron-registry.cjs');
|
|
9
10
|
var jobBuilder = require('./job/job-builder.cjs');
|
|
10
11
|
var jobTransitioner = require('./job/job-transitioner.cjs');
|
|
11
12
|
var grantQueueConfig = require('./queue/grant-queue-config.cjs');
|
|
@@ -27,6 +28,7 @@ exports.Dispatcher = dispatcher.Dispatcher;
|
|
|
27
28
|
exports.ExecutorManager = executorManager.ExecutorManager;
|
|
28
29
|
exports.QueueManager = queueManager.QueueManager;
|
|
29
30
|
exports.JOB_BUILDER_FALLBACK = constants$1.JOB_BUILDER_FALLBACK;
|
|
31
|
+
exports.ScheduledJobRegistry = cronRegistry.ScheduledJobRegistry;
|
|
30
32
|
exports.JobBuilder = jobBuilder.JobBuilder;
|
|
31
33
|
exports.JobTransitioner = jobTransitioner.JobTransitioner;
|
|
32
34
|
exports.differentQueueConfig = grantQueueConfig.differentQueueConfig;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { Dispatcher } from './execution/dispatcher.js';
|
|
|
4
4
|
export { ExecutorManager } from './execution/executor-manager.js';
|
|
5
5
|
export { QueueManager } from './execution/queue-manager.js';
|
|
6
6
|
export { JOB_BUILDER_FALLBACK } from './job/constants.js';
|
|
7
|
+
export { ScheduledJobRegistry } from './job/cron-registry.js';
|
|
7
8
|
export { JobBuilder, JobBuilderDefaults, UniquenessInput } from './job/job-builder.js';
|
|
8
9
|
export { JobTransitioner } from './job/job-transitioner.js';
|
|
9
10
|
export { QueueDefaults, differentQueueConfig, grantQueueConfig } from './queue/grant-queue-config.js';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { Dispatcher } from './execution/dispatcher.js';
|
|
|
4
4
|
export { ExecutorManager } from './execution/executor-manager.js';
|
|
5
5
|
export { QueueManager } from './execution/queue-manager.js';
|
|
6
6
|
export { JOB_BUILDER_FALLBACK } from './job/constants.js';
|
|
7
|
+
export { ScheduledJobRegistry } from './job/cron-registry.js';
|
|
7
8
|
export { JobBuilder } from './job/job-builder.js';
|
|
8
9
|
export { JobTransitioner } from './job/job-transitioner.js';
|
|
9
10
|
export { differentQueueConfig, grantQueueConfig } from './queue/grant-queue-config.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
package/dist/job/constants.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../src/job/constants.ts"],"sourcesContent":[null],"names":["JOB_FALLBACK"],"mappings":";;;;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAwD;AACvF,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,KAAK;IACjB,WAAW,EAAEA,oBAAY,CAAC,YAAY;AACtC,IAAA,IAAI,WAAW,GAAA;QACb,OAAO,IAAI,IAAI,EAAE;IACnB,CAAC;AACD,IAAA,eAAe,EAAE,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../src/job/constants.ts"],"sourcesContent":[null],"names":["JOB_FALLBACK"],"mappings":";;;;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAwD;AACvF,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,KAAK;IACjB,WAAW,EAAEA,oBAAY,CAAC,YAAY;AACtC,IAAA,IAAI,WAAW,GAAA;QACb,OAAO,IAAI,IAAI,EAAE;IACnB,CAAC;AACD,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,UAAU,EAAE,IAAI;IAChB,eAAe,EAAEA,oBAAY,CAAC,gBAAgB;;;;;"}
|
package/dist/job/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../src/job/constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAwD;AACvF,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,YAAY,CAAC,YAAY;AACtC,IAAA,IAAI,WAAW,GAAA;QACb,OAAO,IAAI,IAAI,EAAE;IACnB,CAAC;AACD,IAAA,eAAe,EAAE,EAAE;;;;;"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../src/job/constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;;;;;;;AAYG;AACI,MAAM,oBAAoB,GAAwD;AACvF,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,YAAY,CAAC,YAAY;AACtC,IAAA,IAAI,WAAW,GAAA;QACb,OAAO,IAAI,IAAI,EAAE;IACnB,CAAC;AACD,IAAA,eAAe,EAAE,EAAE;AACnB,IAAA,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,YAAY,CAAC,gBAAgB;;;;;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@sidequest/core');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A registry for tracking and managing scheduled cron jobs.
|
|
7
|
+
* This allows centralized control over all scheduled tasks for proper cleanup.
|
|
8
|
+
*/
|
|
9
|
+
class ScheduledJobRegistry {
|
|
10
|
+
static scheduledTasks = new Map();
|
|
11
|
+
/**
|
|
12
|
+
* Register a scheduled task in the registry.
|
|
13
|
+
* @param task - The scheduled task to register
|
|
14
|
+
* @returns A unique task ID for the registered task
|
|
15
|
+
*/
|
|
16
|
+
static register(task) {
|
|
17
|
+
this.scheduledTasks.set(task.id, task);
|
|
18
|
+
core.logger("CronRegistry").debug(`Registered scheduled task ${task.id}`);
|
|
19
|
+
return task.id;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Unregister and stop a specific scheduled task.
|
|
23
|
+
* @param taskId - The ID of the task to unregister
|
|
24
|
+
* @returns True if the task was found and stopped, false otherwise
|
|
25
|
+
*/
|
|
26
|
+
static async stop(taskId) {
|
|
27
|
+
const task = this.scheduledTasks.get(taskId);
|
|
28
|
+
if (task) {
|
|
29
|
+
try {
|
|
30
|
+
await task.stop();
|
|
31
|
+
core.logger("CronRegistry").debug(`Stopped scheduled task ${taskId}`);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
core.logger("CronRegistry").error(`Error stopping scheduled task ${taskId}:`, error);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
this.scheduledTasks.delete(taskId);
|
|
40
|
+
core.logger("CronRegistry").debug(`Unregistered scheduled task ${taskId}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Stop and unregister all scheduled tasks.
|
|
47
|
+
* This should be called during application shutdown to ensure proper cleanup.
|
|
48
|
+
*/
|
|
49
|
+
static async stopAll() {
|
|
50
|
+
const taskCount = this.scheduledTasks.size;
|
|
51
|
+
if (taskCount === 0) {
|
|
52
|
+
core.logger("CronRegistry").debug("No scheduled tasks to stop");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
core.logger("CronRegistry").info(`Stopping ${taskCount} scheduled task(s)...`);
|
|
56
|
+
for (const [taskId, task] of this.scheduledTasks) {
|
|
57
|
+
try {
|
|
58
|
+
await task.stop();
|
|
59
|
+
core.logger("CronRegistry").debug(`Stopped scheduled task ${taskId}`);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
core.logger("CronRegistry").error(`Error stopping scheduled task ${taskId}:`, error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
this.scheduledTasks.clear();
|
|
66
|
+
core.logger("CronRegistry").info("All scheduled tasks stopped and registry cleared");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the number of registered tasks.
|
|
70
|
+
* @returns The count of registered tasks
|
|
71
|
+
*/
|
|
72
|
+
static getTaskCount() {
|
|
73
|
+
return this.scheduledTasks.size;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if a task is registered.
|
|
77
|
+
* @param taskId - The ID of the task to check
|
|
78
|
+
* @returns True if the task is registered, false otherwise
|
|
79
|
+
*/
|
|
80
|
+
static hasTask(taskId) {
|
|
81
|
+
return this.scheduledTasks.has(taskId);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.ScheduledJobRegistry = ScheduledJobRegistry;
|
|
86
|
+
//# sourceMappingURL=cron-registry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-registry.cjs","sources":["../../src/job/c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IAAI,SAAS,KAAK,CAAC,EAAE;YACnBA,WAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC;YAC1D;QACF;QAEAA,WAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAA,SAAA,EAAY,SAAS,CAAA,qBAAA,CAAuB,CAAC;QAEzE,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,cAAc,EAAE;AAChD,YAAA,IAAI;AACF,gBAAA,MAAM,IAAI,CAAC,IAAI,EAAE;gBACjBA,WAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAA,uBAAA,EAA0B,MAAM,CAAA,CAAE,CAAC;YAClE;YAAE,OAAO,KAAK,EAAE;AACd,gBAAAA,WAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAA,8BAAA,EAAiC,MAAM,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;YACjF;QACF;AAEA,QAAA,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE;QAC3BA,WAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,kDAAkD,CAAC;IACjF;AAEA;;;AAGG;AACH,IAAA,OAAO,YAAY,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI;IACjC;AAEA;;;;AAIG;IACH,OAAO,OAAO,CAAC,MAAc,EAAA;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC;IACxC;;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ScheduledTask } from 'node-cron';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A registry for tracking and managing scheduled cron jobs.
|
|
5
|
+
* This allows centralized control over all scheduled tasks for proper cleanup.
|
|
6
|
+
*/
|
|
7
|
+
declare class ScheduledJobRegistry {
|
|
8
|
+
private static scheduledTasks;
|
|
9
|
+
/**
|
|
10
|
+
* Register a scheduled task in the registry.
|
|
11
|
+
* @param task - The scheduled task to register
|
|
12
|
+
* @returns A unique task ID for the registered task
|
|
13
|
+
*/
|
|
14
|
+
static register(task: ScheduledTask): string;
|
|
15
|
+
/**
|
|
16
|
+
* Unregister and stop a specific scheduled task.
|
|
17
|
+
* @param taskId - The ID of the task to unregister
|
|
18
|
+
* @returns True if the task was found and stopped, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
static stop(taskId: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Stop and unregister all scheduled tasks.
|
|
23
|
+
* This should be called during application shutdown to ensure proper cleanup.
|
|
24
|
+
*/
|
|
25
|
+
static stopAll(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the number of registered tasks.
|
|
28
|
+
* @returns The count of registered tasks
|
|
29
|
+
*/
|
|
30
|
+
static getTaskCount(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a task is registered.
|
|
33
|
+
* @param taskId - The ID of the task to check
|
|
34
|
+
* @returns True if the task is registered, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
static hasTask(taskId: string): boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { ScheduledJobRegistry };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { logger } from '@sidequest/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A registry for tracking and managing scheduled cron jobs.
|
|
5
|
+
* This allows centralized control over all scheduled tasks for proper cleanup.
|
|
6
|
+
*/
|
|
7
|
+
class ScheduledJobRegistry {
|
|
8
|
+
static scheduledTasks = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Register a scheduled task in the registry.
|
|
11
|
+
* @param task - The scheduled task to register
|
|
12
|
+
* @returns A unique task ID for the registered task
|
|
13
|
+
*/
|
|
14
|
+
static register(task) {
|
|
15
|
+
this.scheduledTasks.set(task.id, task);
|
|
16
|
+
logger("CronRegistry").debug(`Registered scheduled task ${task.id}`);
|
|
17
|
+
return task.id;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Unregister and stop a specific scheduled task.
|
|
21
|
+
* @param taskId - The ID of the task to unregister
|
|
22
|
+
* @returns True if the task was found and stopped, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
static async stop(taskId) {
|
|
25
|
+
const task = this.scheduledTasks.get(taskId);
|
|
26
|
+
if (task) {
|
|
27
|
+
try {
|
|
28
|
+
await task.stop();
|
|
29
|
+
logger("CronRegistry").debug(`Stopped scheduled task ${taskId}`);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
logger("CronRegistry").error(`Error stopping scheduled task ${taskId}:`, error);
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
this.scheduledTasks.delete(taskId);
|
|
38
|
+
logger("CronRegistry").debug(`Unregistered scheduled task ${taskId}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stop and unregister all scheduled tasks.
|
|
45
|
+
* This should be called during application shutdown to ensure proper cleanup.
|
|
46
|
+
*/
|
|
47
|
+
static async stopAll() {
|
|
48
|
+
const taskCount = this.scheduledTasks.size;
|
|
49
|
+
if (taskCount === 0) {
|
|
50
|
+
logger("CronRegistry").debug("No scheduled tasks to stop");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
logger("CronRegistry").info(`Stopping ${taskCount} scheduled task(s)...`);
|
|
54
|
+
for (const [taskId, task] of this.scheduledTasks) {
|
|
55
|
+
try {
|
|
56
|
+
await task.stop();
|
|
57
|
+
logger("CronRegistry").debug(`Stopped scheduled task ${taskId}`);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
logger("CronRegistry").error(`Error stopping scheduled task ${taskId}:`, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
this.scheduledTasks.clear();
|
|
64
|
+
logger("CronRegistry").info("All scheduled tasks stopped and registry cleared");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the number of registered tasks.
|
|
68
|
+
* @returns The count of registered tasks
|
|
69
|
+
*/
|
|
70
|
+
static getTaskCount() {
|
|
71
|
+
return this.scheduledTasks.size;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Check if a task is registered.
|
|
75
|
+
* @param taskId - The ID of the task to check
|
|
76
|
+
* @returns True if the task is registered, false otherwise
|
|
77
|
+
*/
|
|
78
|
+
static hasTask(taskId) {
|
|
79
|
+
return this.scheduledTasks.has(taskId);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { ScheduledJobRegistry };
|
|
84
|
+
//# sourceMappingURL=cron-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron-registry.js","sources":["../../src/job/cron-registry.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;AAGG;MACU,oBAAoB,CAAA;AACvB,IAAA,OAAO,cAAc,GAAG,IAAI,GAAG,EAAyB;AAEhE;;;;AAIG;IACH,OAAO,QAAQ,CAAC,IAAmB,EAAA;QACjC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC;AACtC,QAAA,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAA,0BAAA,EAA6B,IAAI,CAAC,EAAE,CAAA,CAAE,CAAC;QACpE,OAAO,IAAI,CAAC,EAAE;IAChB;AAEA;;;;AAIG;AACH,IAAA,aAAa,IAAI,CAAC,MAAc,EAAA;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC;QAC5C,IAAI,IAAI,EAAE;AACR,YAAA,IAAI;AACF,gBAAA,MAAM,IAAI,CAAC,IAAI,EAAE;gBACjB,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,CAAA,uBAAA,EAA0B,MA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D,CAAC;IACjF;AAEA;;;AAGG;AACH,IAAA,OAAO,YAAY,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI;IACjC;AAEA;;;;AAIG;IACH,OAAO,OAAO,CAAC,MAAc,EAAA;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC;IACxC;;;;;"}
|
package/dist/job/job-builder.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var manualLoader = require('../shared-runner/manual-loader.cjs');
|
|
|
7
7
|
require('piscina');
|
|
8
8
|
require('../constants.cjs');
|
|
9
9
|
var constants = require('./constants.cjs');
|
|
10
|
+
var cronRegistry = require('./cron-registry.cjs');
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Builder for creating and enqueuing jobs with custom configuration.
|
|
@@ -23,6 +24,8 @@ class JobBuilder {
|
|
|
23
24
|
uniquenessConfig;
|
|
24
25
|
jobMaxAttempts;
|
|
25
26
|
jobAvailableAt;
|
|
27
|
+
jobRetryDelay;
|
|
28
|
+
jobBackoffStrategy;
|
|
26
29
|
/**
|
|
27
30
|
* Creates a new JobBuilder for the given job class.
|
|
28
31
|
* @param JobClass The job class constructor.
|
|
@@ -38,6 +41,8 @@ class JobBuilder {
|
|
|
38
41
|
this.timeout(this.defaults?.timeout ?? constants.JOB_BUILDER_FALLBACK.timeout);
|
|
39
42
|
this.unique(this.defaults?.uniqueness ?? constants.JOB_BUILDER_FALLBACK.uniqueness);
|
|
40
43
|
this.with(...constants.JOB_BUILDER_FALLBACK.constructorArgs);
|
|
44
|
+
this.retryDelay(this.defaults?.retryDelay ?? constants.JOB_BUILDER_FALLBACK.retryDelay);
|
|
45
|
+
this.backoffStrategy(this.defaults?.backoffStrategy ?? constants.JOB_BUILDER_FALLBACK.backoffStrategy);
|
|
41
46
|
}
|
|
42
47
|
/**
|
|
43
48
|
* Sets the constructor arguments for the job.
|
|
@@ -121,6 +126,30 @@ class JobBuilder {
|
|
|
121
126
|
this.jobAvailableAt = value;
|
|
122
127
|
return this;
|
|
123
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Delay before retrying a failed job, in milliseconds.
|
|
131
|
+
*
|
|
132
|
+
* If "backoff_strategy" is "exponential", this value is used as the base delay for calculating exponential backoff.
|
|
133
|
+
*
|
|
134
|
+
* @param value The retry delay in milliseconds.
|
|
135
|
+
* @returns This builder instance.
|
|
136
|
+
*/
|
|
137
|
+
retryDelay(value) {
|
|
138
|
+
this.jobRetryDelay = value;
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Strategy used for calculating backoff delays between retries.
|
|
143
|
+
* - "exponential": Delays increase exponentially with each attempt.
|
|
144
|
+
* - "fixed": Delays remain constant for each attempt.
|
|
145
|
+
*
|
|
146
|
+
* @param value The backoff strategy.
|
|
147
|
+
* @returns This builder instance.
|
|
148
|
+
*/
|
|
149
|
+
backoffStrategy(value) {
|
|
150
|
+
this.jobBackoffStrategy = value;
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
124
153
|
async build(...args) {
|
|
125
154
|
const job = new this.JobClass(...this.constructorArgs);
|
|
126
155
|
if (!this.manualJobResolution) {
|
|
@@ -148,6 +177,8 @@ class JobBuilder {
|
|
|
148
177
|
available_at: this.jobAvailableAt,
|
|
149
178
|
timeout: this.jobTimeout,
|
|
150
179
|
uniqueness_config: this.uniquenessConfig,
|
|
180
|
+
retry_delay: this.jobRetryDelay,
|
|
181
|
+
backoff_strategy: this.jobBackoffStrategy,
|
|
151
182
|
};
|
|
152
183
|
if (this.uniquenessConfig) {
|
|
153
184
|
const uniqueness = core.UniquenessFactory.create(this.uniquenessConfig);
|
|
@@ -176,10 +207,11 @@ class JobBuilder {
|
|
|
176
207
|
* @remarks
|
|
177
208
|
* - The schedule is **not persisted** to any database. It will be lost if the process restarts and must be re-registered at startup.
|
|
178
209
|
* - You must call this method during application initialization to ensure the job is scheduled correctly.
|
|
179
|
-
* - Uses node-cron
|
|
210
|
+
* - Uses node-cron's `noOverlap: true` option to prevent concurrent executions.
|
|
211
|
+
* - The scheduled task is registered with the CronRegistry for proper cleanup during shutdown.
|
|
180
212
|
*
|
|
181
213
|
* @param cronExpression - A valid cron expression (node-cron compatible) that defines when the job should be enqueued.
|
|
182
|
-
* @param args - Arguments to be passed to the job
|
|
214
|
+
* @param args - Arguments to be passed to the job's `run` method on each scheduled execution.
|
|
183
215
|
*
|
|
184
216
|
* @returns The underlying `ScheduledTask` instance created by node-cron.
|
|
185
217
|
*
|
|
@@ -198,11 +230,14 @@ class JobBuilder {
|
|
|
198
230
|
Object.freeze(jobData);
|
|
199
231
|
core.logger("JobBuilder").debug(`Scheduling job ${jobData.class} with cron: "${cronExpression}", args: ${node_util.inspect(args)}, ` +
|
|
200
232
|
`constructor args: ${node_util.inspect(this.constructorArgs)}`);
|
|
201
|
-
|
|
233
|
+
const scheduledTask = nodeCron.schedule(cronExpression, async () => {
|
|
202
234
|
const newJobData = Object.assign({}, jobData);
|
|
203
235
|
core.logger("JobBuilder").debug(`Cron triggered for job ${newJobData.class} at ${newJobData.available_at.toISOString()} with args: ${node_util.inspect(args)}`);
|
|
204
236
|
return this.backend.createNewJob(jobData);
|
|
205
237
|
}, { noOverlap: true });
|
|
238
|
+
// Register the scheduled task with the ScheduledJobRegistry for proper later cleanup
|
|
239
|
+
cronRegistry.ScheduledJobRegistry.register(scheduledTask);
|
|
240
|
+
return scheduledTask;
|
|
206
241
|
}
|
|
207
242
|
}
|
|
208
243
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-builder.cjs","sources":["../../src/job/job-builder.ts"],"sourcesContent":[null],"names":["JOB_BUILDER_FALLBACK","MANUAL_SCRIPT_TAG","UniquenessFactory","logger","inspect"],"mappings":"
|
|
1
|
+
{"version":3,"file":"job-builder.cjs","sources":["../../src/job/job-builder.ts"],"sourcesContent":[null],"names":["JOB_BUILDER_FALLBACK","MANUAL_SCRIPT_TAG","UniquenessFactory","logger","insp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CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;;;AAIzC,QAAA,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;AAEtB,QAAAD,WAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CACxB,CAAA,eAAA,EAAkB,OAAO,CAAC,KAAK,gBAAgB,cAAc,CAAA,SAAA,EAAYC,iBAAO,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;YACxF,CAAA,kBAAA,EAAqBA,iBAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA,CAAE,CACvD;QAED,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CACrC,cAAc,EACd,YAAW;YACT,MAAM,UAAU,GAAe,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC;YACzDD,WAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CACxB,CAAA,uBAAA,EAA0B,UAAU,CAAC,KAAK,CAAA,IAAA,EAAO,UAAU,CAAC,YAAa,CAAC,WAAW,EAAE,CAAA,YAAA,EAAeC,iBAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CACtH;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;AAC3C,QAAA,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB;;AAGD,QAAAC,iCAAoB,CAAC,QAAQ,CAAC,aAAa,CAAC;AAE5C,QAAA,OAAO,aAAa;IACtB;AACD;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Backend } from '@sidequest/backend';
|
|
2
|
-
import { TimePeriod, JobClassType, JobData } from '@sidequest/core';
|
|
1
|
+
import { Backend, NewJobData } from '@sidequest/backend';
|
|
2
|
+
import { TimePeriod, BackoffStrategy, JobClassType, UniquenessConfig, JobData } from '@sidequest/core';
|
|
3
3
|
import { ScheduledTask } from 'node-cron';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -42,22 +42,28 @@ interface JobBuilderDefaults {
|
|
|
42
42
|
maxAttempts?: number;
|
|
43
43
|
/** Default available at date for jobs built with the JobBuilder */
|
|
44
44
|
availableAt?: Date;
|
|
45
|
+
/** Default retry delay in milliseconds for jobs built with the JobBuilder */
|
|
46
|
+
retryDelay?: number;
|
|
47
|
+
/** Default backoff strategy for jobs built with the JobBuilder */
|
|
48
|
+
backoffStrategy?: BackoffStrategy;
|
|
45
49
|
}
|
|
46
50
|
/**
|
|
47
51
|
* Builder for creating and enqueuing jobs with custom configuration.
|
|
48
52
|
* @template T The job class type.
|
|
49
53
|
*/
|
|
50
54
|
declare class JobBuilder<T extends JobClassType> {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
protected backend: Backend;
|
|
56
|
+
protected JobClass: T;
|
|
57
|
+
protected defaults?: JobBuilderDefaults | undefined;
|
|
58
|
+
protected manualJobResolution: boolean;
|
|
59
|
+
protected constructorArgs?: ConstructorParameters<T>;
|
|
60
|
+
protected queueName?: string;
|
|
61
|
+
protected jobTimeout?: number;
|
|
62
|
+
protected uniquenessConfig?: UniquenessConfig;
|
|
63
|
+
protected jobMaxAttempts?: number;
|
|
64
|
+
protected jobAvailableAt?: Date;
|
|
65
|
+
protected jobRetryDelay?: number;
|
|
66
|
+
protected jobBackoffStrategy?: BackoffStrategy;
|
|
61
67
|
/**
|
|
62
68
|
* Creates a new JobBuilder for the given job class.
|
|
63
69
|
* @param JobClass The job class constructor.
|
|
@@ -104,7 +110,25 @@ declare class JobBuilder<T extends JobClassType> {
|
|
|
104
110
|
* @returns This builder instance.
|
|
105
111
|
*/
|
|
106
112
|
availableAt(value: Date): this;
|
|
107
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Delay before retrying a failed job, in milliseconds.
|
|
115
|
+
*
|
|
116
|
+
* If "backoff_strategy" is "exponential", this value is used as the base delay for calculating exponential backoff.
|
|
117
|
+
*
|
|
118
|
+
* @param value The retry delay in milliseconds.
|
|
119
|
+
* @returns This builder instance.
|
|
120
|
+
*/
|
|
121
|
+
retryDelay(value: number): this;
|
|
122
|
+
/**
|
|
123
|
+
* Strategy used for calculating backoff delays between retries.
|
|
124
|
+
* - "exponential": Delays increase exponentially with each attempt.
|
|
125
|
+
* - "fixed": Delays remain constant for each attempt.
|
|
126
|
+
*
|
|
127
|
+
* @param value The backoff strategy.
|
|
128
|
+
* @returns This builder instance.
|
|
129
|
+
*/
|
|
130
|
+
backoffStrategy(value: BackoffStrategy): this;
|
|
131
|
+
protected build(...args: Parameters<InstanceType<T>["run"]>): Promise<NewJobData>;
|
|
108
132
|
/**
|
|
109
133
|
* Enqueues the job with the specified arguments.
|
|
110
134
|
* @param args Arguments to pass to the job's run method.
|
|
@@ -120,10 +144,11 @@ declare class JobBuilder<T extends JobClassType> {
|
|
|
120
144
|
* @remarks
|
|
121
145
|
* - The schedule is **not persisted** to any database. It will be lost if the process restarts and must be re-registered at startup.
|
|
122
146
|
* - You must call this method during application initialization to ensure the job is scheduled correctly.
|
|
123
|
-
* - Uses node-cron
|
|
147
|
+
* - Uses node-cron's `noOverlap: true` option to prevent concurrent executions.
|
|
148
|
+
* - The scheduled task is registered with the CronRegistry for proper cleanup during shutdown.
|
|
124
149
|
*
|
|
125
150
|
* @param cronExpression - A valid cron expression (node-cron compatible) that defines when the job should be enqueued.
|
|
126
|
-
* @param args - Arguments to be passed to the job
|
|
151
|
+
* @param args - Arguments to be passed to the job's `run` method on each scheduled execution.
|
|
127
152
|
*
|
|
128
153
|
* @returns The underlying `ScheduledTask` instance created by node-cron.
|
|
129
154
|
*
|
package/dist/job/job-builder.js
CHANGED
|
@@ -5,6 +5,7 @@ import { MANUAL_SCRIPT_TAG } from '../shared-runner/manual-loader.js';
|
|
|
5
5
|
import 'piscina';
|
|
6
6
|
import '../constants.js';
|
|
7
7
|
import { JOB_BUILDER_FALLBACK } from './constants.js';
|
|
8
|
+
import { ScheduledJobRegistry } from './cron-registry.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Builder for creating and enqueuing jobs with custom configuration.
|
|
@@ -21,6 +22,8 @@ class JobBuilder {
|
|
|
21
22
|
uniquenessConfig;
|
|
22
23
|
jobMaxAttempts;
|
|
23
24
|
jobAvailableAt;
|
|
25
|
+
jobRetryDelay;
|
|
26
|
+
jobBackoffStrategy;
|
|
24
27
|
/**
|
|
25
28
|
* Creates a new JobBuilder for the given job class.
|
|
26
29
|
* @param JobClass The job class constructor.
|
|
@@ -36,6 +39,8 @@ class JobBuilder {
|
|
|
36
39
|
this.timeout(this.defaults?.timeout ?? JOB_BUILDER_FALLBACK.timeout);
|
|
37
40
|
this.unique(this.defaults?.uniqueness ?? JOB_BUILDER_FALLBACK.uniqueness);
|
|
38
41
|
this.with(...JOB_BUILDER_FALLBACK.constructorArgs);
|
|
42
|
+
this.retryDelay(this.defaults?.retryDelay ?? JOB_BUILDER_FALLBACK.retryDelay);
|
|
43
|
+
this.backoffStrategy(this.defaults?.backoffStrategy ?? JOB_BUILDER_FALLBACK.backoffStrategy);
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* Sets the constructor arguments for the job.
|
|
@@ -119,6 +124,30 @@ class JobBuilder {
|
|
|
119
124
|
this.jobAvailableAt = value;
|
|
120
125
|
return this;
|
|
121
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Delay before retrying a failed job, in milliseconds.
|
|
129
|
+
*
|
|
130
|
+
* If "backoff_strategy" is "exponential", this value is used as the base delay for calculating exponential backoff.
|
|
131
|
+
*
|
|
132
|
+
* @param value The retry delay in milliseconds.
|
|
133
|
+
* @returns This builder instance.
|
|
134
|
+
*/
|
|
135
|
+
retryDelay(value) {
|
|
136
|
+
this.jobRetryDelay = value;
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Strategy used for calculating backoff delays between retries.
|
|
141
|
+
* - "exponential": Delays increase exponentially with each attempt.
|
|
142
|
+
* - "fixed": Delays remain constant for each attempt.
|
|
143
|
+
*
|
|
144
|
+
* @param value The backoff strategy.
|
|
145
|
+
* @returns This builder instance.
|
|
146
|
+
*/
|
|
147
|
+
backoffStrategy(value) {
|
|
148
|
+
this.jobBackoffStrategy = value;
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
122
151
|
async build(...args) {
|
|
123
152
|
const job = new this.JobClass(...this.constructorArgs);
|
|
124
153
|
if (!this.manualJobResolution) {
|
|
@@ -146,6 +175,8 @@ class JobBuilder {
|
|
|
146
175
|
available_at: this.jobAvailableAt,
|
|
147
176
|
timeout: this.jobTimeout,
|
|
148
177
|
uniqueness_config: this.uniquenessConfig,
|
|
178
|
+
retry_delay: this.jobRetryDelay,
|
|
179
|
+
backoff_strategy: this.jobBackoffStrategy,
|
|
149
180
|
};
|
|
150
181
|
if (this.uniquenessConfig) {
|
|
151
182
|
const uniqueness = UniquenessFactory.create(this.uniquenessConfig);
|
|
@@ -174,10 +205,11 @@ class JobBuilder {
|
|
|
174
205
|
* @remarks
|
|
175
206
|
* - The schedule is **not persisted** to any database. It will be lost if the process restarts and must be re-registered at startup.
|
|
176
207
|
* - You must call this method during application initialization to ensure the job is scheduled correctly.
|
|
177
|
-
* - Uses node-cron
|
|
208
|
+
* - Uses node-cron's `noOverlap: true` option to prevent concurrent executions.
|
|
209
|
+
* - The scheduled task is registered with the CronRegistry for proper cleanup during shutdown.
|
|
178
210
|
*
|
|
179
211
|
* @param cronExpression - A valid cron expression (node-cron compatible) that defines when the job should be enqueued.
|
|
180
|
-
* @param args - Arguments to be passed to the job
|
|
212
|
+
* @param args - Arguments to be passed to the job's `run` method on each scheduled execution.
|
|
181
213
|
*
|
|
182
214
|
* @returns The underlying `ScheduledTask` instance created by node-cron.
|
|
183
215
|
*
|
|
@@ -196,11 +228,14 @@ class JobBuilder {
|
|
|
196
228
|
Object.freeze(jobData);
|
|
197
229
|
logger("JobBuilder").debug(`Scheduling job ${jobData.class} with cron: "${cronExpression}", args: ${inspect(args)}, ` +
|
|
198
230
|
`constructor args: ${inspect(this.constructorArgs)}`);
|
|
199
|
-
|
|
231
|
+
const scheduledTask = nodeCron.schedule(cronExpression, async () => {
|
|
200
232
|
const newJobData = Object.assign({}, jobData);
|
|
201
233
|
logger("JobBuilder").debug(`Cron triggered for job ${newJobData.class} at ${newJobData.available_at.toISOString()} with args: ${inspect(args)}`);
|
|
202
234
|
return this.backend.createNewJob(jobData);
|
|
203
235
|
}, { noOverlap: true });
|
|
236
|
+
// Register the scheduled task with the ScheduledJobRegistry for proper later cleanup
|
|
237
|
+
ScheduledJobRegistry.register(scheduledTask);
|
|
238
|
+
return scheduledTask;
|
|
204
239
|
}
|
|
205
240
|
}
|
|
206
241
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-builder.js","sources":["../../src/job/job-builder.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"job-builder.js","sources":["../../src/job/job-builder.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAkEA;;;AAGG;MACU,UAAU,CAAA;AAeT,IAAA,OAAA;AACA,IAAA,QAAA;AACA,IAAA,QAAA;AACA,IAAA,mBAAA;AAjBF,IAAA,eAAe;AACf,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,gBAAgB;AAChB,IAAA,cAAc;AACd,IAAA,cAAc;AACd,IAAA,aAAa;AACb,IAAA,kBAAkB;AAE5B;;;AAGG;AACH,IAAA,WAAA,CACY,OAAgB,EAChB,QAAW,EACX,QAA6B,EAC7B,sBAAsB,KAAK,EAAA;QAH3B,IAAA,CAAA,OAAO,GAAP,OAAO;QACP,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,QAAQ,GAAR,QAAQ;QACR,IAAA,CAAA,mBAAmB,GAAnB,mBAAmB;AAE7B,QAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,IAAI,oBAA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,OAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CACtH;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;AAC3C,QAAA,CAAC,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB;;AAGD,QAAA,oBAAoB,CAAC,QAAQ,CAAC,aAAa,CAAC;AAE5C,QAAA,OAAO,aAAa;IACtB;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sidequest/engine",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "@sidequest/engine is the core engine of SideQuest, a distributed background job processing system for Node.js and TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "LGPL-3.0-or-later",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sidequest/backend": "1.
|
|
46
|
-
"@sidequest/core": "1.
|
|
47
|
-
"node-cron": "^4.
|
|
48
|
-
"piscina": "^5.1.
|
|
45
|
+
"@sidequest/backend": "1.8.0",
|
|
46
|
+
"@sidequest/core": "1.8.0",
|
|
47
|
+
"node-cron": "^4.2.1",
|
|
48
|
+
"piscina": "^5.1.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"sidequest": "1.
|
|
51
|
+
"sidequest": "1.8.0"
|
|
52
52
|
}
|
|
53
53
|
}
|