@telamonjs/queue 1.0.1 → 1.1.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/CHANGELOG.md +31 -0
- package/README.md +50 -6
- package/dist/core/DeadLetterQueue.d.ts +26 -1
- package/dist/core/DeadLetterQueue.d.ts.map +1 -1
- package/dist/core/DeadLetterQueue.js +62 -1
- package/dist/core/DeadLetterQueue.js.map +1 -1
- package/dist/core/QueueManager.d.ts.map +1 -1
- package/dist/core/QueueManager.js +1 -1
- package/dist/core/QueueManager.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nestjs/constants.d.ts +7 -0
- package/dist/nestjs/constants.d.ts.map +1 -1
- package/dist/nestjs/constants.js +7 -0
- package/dist/nestjs/constants.js.map +1 -1
- package/dist/nestjs/queue-http.module.d.ts +24 -3
- package/dist/nestjs/queue-http.module.d.ts.map +1 -1
- package/dist/nestjs/queue-http.module.js +41 -5
- package/dist/nestjs/queue-http.module.js.map +1 -1
- package/dist/scheduler/SchedulerReconciler.d.ts +28 -19
- package/dist/scheduler/SchedulerReconciler.d.ts.map +1 -1
- package/dist/scheduler/SchedulerReconciler.js +94 -102
- package/dist/scheduler/SchedulerReconciler.js.map +1 -1
- package/dist/utils/validation.d.ts +60 -42
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +4 -0
- package/dist/utils/validation.js.map +1 -1
- package/package.json +7 -6
|
@@ -5,13 +5,48 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var QueueHttpModule_1;
|
|
8
|
-
import { Controller, Module, UseGuards } from '@nestjs/common';
|
|
8
|
+
import { Controller, Module, RequestMethod, SetMetadata, UseGuards } from '@nestjs/common';
|
|
9
|
+
// `.js`: @nestjs/common has no `exports` map, so Node16 resolution needs the file name.
|
|
10
|
+
import { METHOD_METADATA } from '@nestjs/common/constants.js';
|
|
9
11
|
import { QueueControllerBase } from './queue-controller-base.js';
|
|
10
|
-
import { QUEUE_HTTP_DEPS, QUEUE_HTTP_GET_ACTOR } from './constants.js';
|
|
12
|
+
import { PERMISSIONS_METADATA_KEY, QUEUE_HTTP_DEPS, QUEUE_HTTP_GET_ACTOR, } from './constants.js';
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Gives `target` its own copy of every route handler that needs a
|
|
15
|
+
* permission and declares it there. Nest reads handler metadata off the
|
|
16
|
+
* method function, and the inherited ones are shared by every `forRoot()`
|
|
17
|
+
* call — so each bound controller gets a wrapper carrying the route
|
|
18
|
+
* metadata of the original plus its own permissions.
|
|
19
|
+
*/
|
|
20
|
+
function applyRoutePermissions(target, read, write) {
|
|
21
|
+
const base = QueueControllerBase.prototype;
|
|
22
|
+
for (const name of Object.getOwnPropertyNames(base)) {
|
|
23
|
+
const handler = base[name];
|
|
24
|
+
if (name === 'constructor' || typeof handler !== 'function')
|
|
25
|
+
continue;
|
|
26
|
+
const method = Reflect.getMetadata(METHOD_METADATA, handler);
|
|
27
|
+
if (method === undefined)
|
|
28
|
+
continue; // not a route
|
|
29
|
+
const permission = method === RequestMethod.GET ? read : write;
|
|
30
|
+
if (permission === undefined)
|
|
31
|
+
continue;
|
|
32
|
+
const wrapper = function (...args) {
|
|
33
|
+
return handler.apply(this, args);
|
|
34
|
+
};
|
|
35
|
+
for (const key of Reflect.getOwnMetadataKeys(handler)) {
|
|
36
|
+
Reflect.defineMetadata(key, Reflect.getOwnMetadata(key, handler), wrapper);
|
|
37
|
+
}
|
|
38
|
+
SetMetadata(PERMISSIONS_METADATA_KEY, typeof permission === 'string' ? [permission] : permission)(wrapper);
|
|
39
|
+
Object.defineProperty(target.prototype, name, {
|
|
40
|
+
value: wrapper,
|
|
41
|
+
writable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Wires the pure `./http` handlers + the SSE route to a NestJS controller.
|
|
48
|
+
* `@nestjs/common`/`@nestjs/core` are optional peers — only a consumer that
|
|
49
|
+
* imports `./nestjs` pays for them.
|
|
15
50
|
*/
|
|
16
51
|
let QueueHttpModule = QueueHttpModule_1 = class QueueHttpModule {
|
|
17
52
|
static forRoot(options) {
|
|
@@ -22,6 +57,7 @@ let QueueHttpModule = QueueHttpModule_1 = class QueueHttpModule {
|
|
|
22
57
|
UseGuards(...guards),
|
|
23
58
|
Controller('queue')
|
|
24
59
|
], BoundQueueController);
|
|
60
|
+
applyRoutePermissions(BoundQueueController, options.readPermission, options.writePermission);
|
|
25
61
|
return {
|
|
26
62
|
module: QueueHttpModule_1,
|
|
27
63
|
controllers: [BoundQueueController],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-http.module.js","sourceRoot":"","sources":["../../src/nestjs/queue-http.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"queue-http.module.js","sourceRoot":"","sources":["../../src/nestjs/queue-http.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1F,wFAAwF;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAQ7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,oBAAoB,GACrB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,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;SACnB,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAED;;;;GAIG;AAEI,IAAM,eAAe,uBAArB,MAAM,eAAe;IACnB,AAAP,MAAM,CAAC,OAAO,CAAC,OAA+B;QAC5C,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QAInE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,mBAAmB;SAAG,CAAA;QAAnD,oBAAoB;YAFzB,SAAS,CAAC,GAAG,MAAM,CAAC;YACpB,UAAU,CAAC,OAAO,CAAC;WACd,oBAAoB,CAA+B;QAEzD,qBAAqB,CAAC,oBAAoB,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;QAE5F,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,WAAW,EAAE,CAAC,oBAAoB,CAAC;YACnC,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE;gBAC7D,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE;aACtD;SACF,CAAA;IACH,CAAC;CACF,CAAA;AAnBY,eAAe;IAD3B,MAAM,CAAC,EAAE,CAAC;GACE,eAAe,CAmB3B"}
|
|
@@ -21,18 +21,21 @@ export interface SchedulerReconcilerStats {
|
|
|
21
21
|
reconcileIntervalMs: number;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Reconciliation loop that keeps BullMQ
|
|
24
|
+
* Reconciliation loop that keeps BullMQ job schedulers in sync with the
|
|
25
25
|
* desired state in a `JobConfigStore` - enable/disable and cron edits via a
|
|
26
|
-
* dashboard take effect with no redeploy, and a restart self-heals (
|
|
27
|
-
*
|
|
26
|
+
* dashboard take effect with no redeploy, and a restart self-heals (schedulers
|
|
27
|
+
* are read back from Redis, not from in-memory state).
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
29
|
+
* Each job gets one job scheduler whose id is the job name, written with
|
|
30
|
+
* `upsertJobScheduler` (idempotent, updates in place). Legacy repeatables of
|
|
31
|
+
* a managed job - left by versions that used `add(..., { repeat })` - are
|
|
32
|
+
* removed (with their pending iteration) before the scheduler is upserted,
|
|
33
|
+
* so an upgraded deployment never runs a job twice.
|
|
34
|
+
*
|
|
35
|
+
* Job options come from `new JobClass().options` (`Job.options`, minus
|
|
36
|
+
* `jobId`/`delay`, which a scheduler owns); timezone/priority are read straight
|
|
37
|
+
* off `JobConfig` (already resolved by `JobConfigStore`'s own defaults - see
|
|
38
|
+
* `JobConfigStoreOptions.defaultTimezone`), never a hardcoded timezone.
|
|
36
39
|
*
|
|
37
40
|
* Depends on `QueueRegistry` (not `QueueManager`) so every reconcile cycle
|
|
38
41
|
* reuses the same `Queue` instances over one shared Redis connection -
|
|
@@ -57,10 +60,17 @@ export declare class SchedulerReconciler {
|
|
|
57
60
|
*/
|
|
58
61
|
start(): Promise<void>;
|
|
59
62
|
/**
|
|
60
|
-
* Reconciles desired state (`JobConfigStore`) with actual state (BullMQ
|
|
61
|
-
*
|
|
63
|
+
* Reconciles desired state (`JobConfigStore`) with actual state (BullMQ job
|
|
64
|
+
* schedulers). Never throws - a failure is logged and the next cycle
|
|
62
65
|
* (interval or manual) tries again, matching the upstream resilience
|
|
63
66
|
* contract (a bad reconcile cycle must not crash the scheduler process).
|
|
67
|
+
*
|
|
68
|
+
* Counts in the "completed with changes" log: `added` = a job scheduled by
|
|
69
|
+
* this instance for the first time (every job after a restart, including a
|
|
70
|
+
* legacy repeatable migrated to a scheduler); `removed` = one schedule entry
|
|
71
|
+
* removed because its job is no longer enabled with a cron; `updated` = a
|
|
72
|
+
* scheduled job re-upserted because its cron/timezone/priority changed or
|
|
73
|
+
* a stray legacy repeatable for it reappeared.
|
|
64
74
|
*/
|
|
65
75
|
reconcile(): Promise<void>;
|
|
66
76
|
/**
|
|
@@ -72,13 +82,12 @@ export declare class SchedulerReconciler {
|
|
|
72
82
|
stop(): void;
|
|
73
83
|
getStats(): SchedulerReconcilerStats;
|
|
74
84
|
/**
|
|
75
|
-
*
|
|
76
|
-
* reusing `QueueRegistry`'s cached `Queue` instances (one
|
|
77
|
-
* per known job, not per tick per Queue instance).
|
|
85
|
+
* Reads every schedule (job scheduler or legacy repeatable) of the jobs
|
|
86
|
+
* known in code, reusing `QueueRegistry`'s cached `Queue` instances (one
|
|
87
|
+
* Redis round trip per known job, not per tick per Queue instance).
|
|
78
88
|
*/
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private
|
|
82
|
-
private removeJob;
|
|
89
|
+
private getSchedulesFromRedis;
|
|
90
|
+
private removeSchedule;
|
|
91
|
+
private upsertJob;
|
|
83
92
|
}
|
|
84
93
|
//# sourceMappingURL=SchedulerReconciler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchedulerReconciler.d.ts","sourceRoot":"","sources":["../../src/scheduler/SchedulerReconciler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"SchedulerReconciler.d.ts","sourceRoot":"","sources":["../../src/scheduler/SchedulerReconciler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEt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c;YAiBd,SAAS;CAqDxB"}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { assertNoLegacySchedule } from '../core/Job.js';
|
|
2
2
|
import { NoOpLogger } from '@telamonjs/logger';
|
|
3
3
|
/**
|
|
4
|
-
* Reconciliation loop that keeps BullMQ
|
|
4
|
+
* Reconciliation loop that keeps BullMQ job schedulers in sync with the
|
|
5
5
|
* desired state in a `JobConfigStore` - enable/disable and cron edits via a
|
|
6
|
-
* dashboard take effect with no redeploy, and a restart self-heals (
|
|
7
|
-
*
|
|
6
|
+
* dashboard take effect with no redeploy, and a restart self-heals (schedulers
|
|
7
|
+
* are read back from Redis, not from in-memory state).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* Each job gets one job scheduler whose id is the job name, written with
|
|
10
|
+
* `upsertJobScheduler` (idempotent, updates in place). Legacy repeatables of
|
|
11
|
+
* a managed job - left by versions that used `add(..., { repeat })` - are
|
|
12
|
+
* removed (with their pending iteration) before the scheduler is upserted,
|
|
13
|
+
* so an upgraded deployment never runs a job twice.
|
|
14
|
+
*
|
|
15
|
+
* Job options come from `new JobClass().options` (`Job.options`, minus
|
|
16
|
+
* `jobId`/`delay`, which a scheduler owns); timezone/priority are read straight
|
|
17
|
+
* off `JobConfig` (already resolved by `JobConfigStore`'s own defaults - see
|
|
18
|
+
* `JobConfigStoreOptions.defaultTimezone`), never a hardcoded timezone.
|
|
16
19
|
*
|
|
17
20
|
* Depends on `QueueRegistry` (not `QueueManager`) so every reconcile cycle
|
|
18
21
|
* reuses the same `Queue` instances over one shared Redis connection -
|
|
@@ -57,10 +60,17 @@ export class SchedulerReconciler {
|
|
|
57
60
|
this.logger.info('SchedulerReconciler started', { status: 'ready' });
|
|
58
61
|
}
|
|
59
62
|
/**
|
|
60
|
-
* Reconciles desired state (`JobConfigStore`) with actual state (BullMQ
|
|
61
|
-
*
|
|
63
|
+
* Reconciles desired state (`JobConfigStore`) with actual state (BullMQ job
|
|
64
|
+
* schedulers). Never throws - a failure is logged and the next cycle
|
|
62
65
|
* (interval or manual) tries again, matching the upstream resilience
|
|
63
66
|
* contract (a bad reconcile cycle must not crash the scheduler process).
|
|
67
|
+
*
|
|
68
|
+
* Counts in the "completed with changes" log: `added` = a job scheduled by
|
|
69
|
+
* this instance for the first time (every job after a restart, including a
|
|
70
|
+
* legacy repeatable migrated to a scheduler); `removed` = one schedule entry
|
|
71
|
+
* removed because its job is no longer enabled with a cron; `updated` = a
|
|
72
|
+
* scheduled job re-upserted because its cron/timezone/priority changed or
|
|
73
|
+
* a stray legacy repeatable for it reappeared.
|
|
64
74
|
*/
|
|
65
75
|
async reconcile() {
|
|
66
76
|
const startTime = Date.now();
|
|
@@ -73,30 +83,37 @@ export class SchedulerReconciler {
|
|
|
73
83
|
let added = 0;
|
|
74
84
|
let removed = 0;
|
|
75
85
|
let updated = 0;
|
|
76
|
-
const
|
|
77
|
-
for (const [jobName,
|
|
86
|
+
const current = await this.getSchedulesFromRedis();
|
|
87
|
+
for (const [jobName, schedules] of current) {
|
|
78
88
|
if (!desiredJobs.has(jobName)) {
|
|
79
|
-
for (const
|
|
80
|
-
await this.
|
|
89
|
+
for (const schedule of schedules) {
|
|
90
|
+
await this.removeSchedule(jobName, schedule).catch((err) => {
|
|
91
|
+
this.logger.error('SchedulerReconciler failed to remove job', {
|
|
92
|
+
jobName,
|
|
93
|
+
key: schedule.key,
|
|
94
|
+
error: err instanceof Error ? err.message : String(err),
|
|
95
|
+
});
|
|
96
|
+
});
|
|
81
97
|
removed++;
|
|
82
98
|
}
|
|
83
99
|
this.scheduledJobs.delete(jobName);
|
|
84
100
|
}
|
|
85
101
|
}
|
|
86
102
|
for (const [jobName, config] of desiredJobs) {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
const scheduled = this.scheduledJobs.get(jobName);
|
|
104
|
+
// Anything for this job other than its own scheduler: a legacy
|
|
105
|
+
// repeatable, or a scheduler someone created under another id.
|
|
106
|
+
const strays = (current.get(jobName) ?? []).filter(s => s.legacy || s.key !== jobName);
|
|
107
|
+
if (!scheduled) {
|
|
108
|
+
if (await this.upsertJob(jobName, config, strays))
|
|
91
109
|
added++;
|
|
92
110
|
continue;
|
|
93
111
|
}
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (ok)
|
|
112
|
+
if (strays.length > 0 ||
|
|
113
|
+
scheduled.cronPattern !== config.cronPattern ||
|
|
114
|
+
scheduled.timezone !== config.timezone ||
|
|
115
|
+
scheduled.priority !== config.priority) {
|
|
116
|
+
if (await this.upsertJob(jobName, config, strays))
|
|
100
117
|
updated++;
|
|
101
118
|
}
|
|
102
119
|
}
|
|
@@ -143,84 +160,78 @@ export class SchedulerReconciler {
|
|
|
143
160
|
};
|
|
144
161
|
}
|
|
145
162
|
/**
|
|
146
|
-
*
|
|
147
|
-
* reusing `QueueRegistry`'s cached `Queue` instances (one
|
|
148
|
-
* per known job, not per tick per Queue instance).
|
|
163
|
+
* Reads every schedule (job scheduler or legacy repeatable) of the jobs
|
|
164
|
+
* known in code, reusing `QueueRegistry`'s cached `Queue` instances (one
|
|
165
|
+
* Redis round trip per known job, not per tick per Queue instance).
|
|
149
166
|
*/
|
|
150
|
-
async
|
|
167
|
+
async getSchedulesFromRedis() {
|
|
151
168
|
const result = new Map();
|
|
152
169
|
for (const [jobName] of this.jobs) {
|
|
153
170
|
try {
|
|
154
171
|
const queue = this.queueRegistry.getQueue(jobName);
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
result.set(jobName, keys);
|
|
172
|
+
const schedules = (await queue.getJobSchedulers(0, -1))
|
|
173
|
+
.filter(s => s.name === jobName)
|
|
174
|
+
.map(s => ({ key: s.key, legacy: s.iterationCount === undefined }));
|
|
175
|
+
if (schedules.length > 0)
|
|
176
|
+
result.set(jobName, schedules);
|
|
161
177
|
}
|
|
162
|
-
catch {
|
|
163
|
-
//
|
|
164
|
-
//
|
|
178
|
+
catch (err) {
|
|
179
|
+
// One bad queue shouldn't stop the reconcile pass from evaluating
|
|
180
|
+
// the rest - but it must not be invisible either.
|
|
181
|
+
this.logger.warn('SchedulerReconciler failed to read job schedulers', {
|
|
182
|
+
jobName,
|
|
183
|
+
error: err instanceof Error ? err.message : String(err),
|
|
184
|
+
});
|
|
165
185
|
}
|
|
166
186
|
}
|
|
167
187
|
return result;
|
|
168
188
|
}
|
|
169
|
-
async
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
async removeSchedule(jobName, schedule) {
|
|
190
|
+
const queue = this.queueRegistry.getQueue(jobName);
|
|
191
|
+
if (schedule.legacy) {
|
|
192
|
+
// Deprecated in BullMQ, kept only for this migration path: unlike
|
|
193
|
+
// removeJobScheduler it also finds the pending iteration of the oldest
|
|
194
|
+
// `name:id:endDate:tz:pattern` keys.
|
|
195
|
+
await queue.removeRepeatableByKey(schedule.key);
|
|
174
196
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
jobName,
|
|
178
|
-
repeatableKey,
|
|
179
|
-
error: err instanceof Error ? err.message : String(err),
|
|
180
|
-
});
|
|
197
|
+
else {
|
|
198
|
+
await queue.removeJobScheduler(schedule.key);
|
|
181
199
|
}
|
|
200
|
+
this.logger.debug('SchedulerReconciler removed schedule', {
|
|
201
|
+
jobName,
|
|
202
|
+
key: schedule.key,
|
|
203
|
+
legacy: schedule.legacy,
|
|
204
|
+
});
|
|
182
205
|
}
|
|
183
|
-
async
|
|
206
|
+
async upsertJob(jobName, config, strays) {
|
|
184
207
|
const JobClass = this.jobs.get(jobName);
|
|
185
208
|
if (!JobClass) {
|
|
186
209
|
this.logger.warn('SchedulerReconciler: job not found in code', { jobName });
|
|
187
210
|
return false;
|
|
188
211
|
}
|
|
189
212
|
try {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
// side by side with the new one if the pattern/opts changed).
|
|
196
|
-
const existingJobs = await queue.getRepeatableJobs();
|
|
197
|
-
for (const job of existingJobs) {
|
|
198
|
-
if (job.name === jobName) {
|
|
199
|
-
await queue.removeRepeatableByKey(job.key);
|
|
200
|
-
}
|
|
213
|
+
// Strays go first and a failure aborts the upsert: scheduling while a
|
|
214
|
+
// legacy repeatable survives would run the job twice. The next cycle
|
|
215
|
+
// retries the whole thing.
|
|
216
|
+
for (const stray of strays) {
|
|
217
|
+
await this.removeSchedule(jobName, stray);
|
|
201
218
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
219
|
+
// A scheduler owns the job id and the delay of every iteration.
|
|
220
|
+
const { jobId: _jobId, delay: _delay, ...options } = new JobClass().options ?? {};
|
|
221
|
+
const queue = this.queueRegistry.getQueue(jobName);
|
|
222
|
+
await queue.upsertJobScheduler(jobName, { pattern: config.cronPattern, tz: config.timezone }, { name: jobName, data: {}, opts: { ...options, priority: config.priority } });
|
|
223
|
+
this.scheduledJobs.set(jobName, {
|
|
224
|
+
cronPattern: config.cronPattern,
|
|
225
|
+
timezone: config.timezone,
|
|
205
226
|
priority: config.priority,
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
timezone: config.timezone,
|
|
215
|
-
priority: config.priority,
|
|
216
|
-
});
|
|
217
|
-
this.logger.info('SchedulerReconciler scheduled job', {
|
|
218
|
-
jobName,
|
|
219
|
-
cronPattern: config.cronPattern,
|
|
220
|
-
timezone: config.timezone,
|
|
221
|
-
priority: config.priority,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
227
|
+
});
|
|
228
|
+
this.logger.info('SchedulerReconciler scheduled job', {
|
|
229
|
+
jobName,
|
|
230
|
+
cronPattern: config.cronPattern,
|
|
231
|
+
timezone: config.timezone,
|
|
232
|
+
priority: config.priority,
|
|
233
|
+
migratedLegacy: strays.filter(s => s.legacy).length,
|
|
234
|
+
});
|
|
224
235
|
return true;
|
|
225
236
|
}
|
|
226
237
|
catch (err) {
|
|
@@ -231,24 +242,5 @@ export class SchedulerReconciler {
|
|
|
231
242
|
return false;
|
|
232
243
|
}
|
|
233
244
|
}
|
|
234
|
-
async removeJob(jobName, repeatableKey) {
|
|
235
|
-
if (!this.jobs.has(jobName)) {
|
|
236
|
-
this.scheduledJobs.delete(jobName);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
try {
|
|
240
|
-
const queue = this.queueRegistry.getQueue(jobName);
|
|
241
|
-
await queue.removeRepeatableByKey(repeatableKey);
|
|
242
|
-
}
|
|
243
|
-
catch (err) {
|
|
244
|
-
this.logger.error('SchedulerReconciler failed to remove job', {
|
|
245
|
-
jobName,
|
|
246
|
-
error: err instanceof Error ? err.message : String(err),
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
finally {
|
|
250
|
-
this.scheduledJobs.delete(jobName);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
245
|
}
|
|
254
246
|
//# sourceMappingURL=SchedulerReconciler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchedulerReconciler.js","sourceRoot":"","sources":["../../src/scheduler/SchedulerReconciler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAIvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"SchedulerReconciler.js","sourceRoot":"","sources":["../../src/scheduler/SchedulerReconciler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAIvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAwC9C;;;;;;;;;;;;;;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