@softure-ai/jobs 0.1.0 → 0.1.2
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 +28 -0
- package/README.md +86 -10
- package/dist/index.d.ts +55 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/options.d.ts +69 -4
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +73 -10
- package/dist/options.js.map +1 -1
- package/dist/schema.d.ts +92 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +8 -1
- package/dist/schema.js.map +1 -1
- package/dist/server/claim.d.ts +4 -1
- package/dist/server/claim.d.ts.map +1 -1
- package/dist/server/claim.js +13 -3
- package/dist/server/claim.js.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/maintenance.d.ts +5 -2
- package/dist/server/maintenance.d.ts.map +1 -1
- package/dist/server/maintenance.js +5 -3
- package/dist/server/maintenance.js.map +1 -1
- package/dist/server/run-due.d.ts +1 -1
- package/dist/server/run-due.d.ts.map +1 -1
- package/dist/server/run-due.js +3 -1
- package/dist/server/run-due.js.map +1 -1
- package/dist/server/schedules.d.ts +49 -0
- package/dist/server/schedules.d.ts.map +1 -0
- package/dist/server/schedules.js +133 -0
- package/dist/server/schedules.js.map +1 -0
- package/dist/worker/run-job-worker.d.ts.map +1 -1
- package/dist/worker/run-job-worker.js +21 -3
- package/dist/worker/run-job-worker.js.map +1 -1
- package/dist/zoned-time.d.ts +19 -0
- package/dist/zoned-time.d.ts.map +1 -0
- package/dist/zoned-time.js +61 -0
- package/dist/zoned-time.js.map +1 -0
- package/migrations/0002_create_schedules.sql +12 -0
- package/module.json +2 -2
- package/package.json +1 -1
- package/src/index.ts +13 -4
- package/src/options.ts +109 -26
- package/src/schema.ts +9 -1
- package/src/server/claim.ts +11 -3
- package/src/server/index.ts +7 -0
- package/src/server/maintenance.ts +7 -3
- package/src/server/run-due.ts +3 -1
- package/src/server/schedules.ts +157 -0
- package/src/worker/run-job-worker.ts +18 -3
- package/src/zoned-time.ts +75 -0
package/dist/schema.d.ts
CHANGED
|
@@ -262,4 +262,96 @@ export declare const jobs: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
262
262
|
dialect: "pg";
|
|
263
263
|
}>;
|
|
264
264
|
export type JobRow = typeof jobs.$inferSelect;
|
|
265
|
+
export declare const schedules: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
266
|
+
name: "schedules";
|
|
267
|
+
schema: "jobs";
|
|
268
|
+
columns: {
|
|
269
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
270
|
+
name: "name";
|
|
271
|
+
tableName: "schedules";
|
|
272
|
+
dataType: "string";
|
|
273
|
+
columnType: "PgText";
|
|
274
|
+
data: string;
|
|
275
|
+
driverParam: string;
|
|
276
|
+
notNull: true;
|
|
277
|
+
hasDefault: false;
|
|
278
|
+
isPrimaryKey: true;
|
|
279
|
+
isAutoincrement: false;
|
|
280
|
+
hasRuntimeDefault: false;
|
|
281
|
+
enumValues: [string, ...string[]];
|
|
282
|
+
baseColumn: never;
|
|
283
|
+
identity: undefined;
|
|
284
|
+
generated: undefined;
|
|
285
|
+
}, {}, {}>;
|
|
286
|
+
lastSlotAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
287
|
+
name: "last_slot_at";
|
|
288
|
+
tableName: "schedules";
|
|
289
|
+
dataType: "date";
|
|
290
|
+
columnType: "PgTimestamp";
|
|
291
|
+
data: Date;
|
|
292
|
+
driverParam: string;
|
|
293
|
+
notNull: true;
|
|
294
|
+
hasDefault: false;
|
|
295
|
+
isPrimaryKey: false;
|
|
296
|
+
isAutoincrement: false;
|
|
297
|
+
hasRuntimeDefault: false;
|
|
298
|
+
enumValues: undefined;
|
|
299
|
+
baseColumn: never;
|
|
300
|
+
identity: undefined;
|
|
301
|
+
generated: undefined;
|
|
302
|
+
}, {}, {}>;
|
|
303
|
+
lastSucceededAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
304
|
+
name: "last_succeeded_at";
|
|
305
|
+
tableName: "schedules";
|
|
306
|
+
dataType: "date";
|
|
307
|
+
columnType: "PgTimestamp";
|
|
308
|
+
data: Date;
|
|
309
|
+
driverParam: string;
|
|
310
|
+
notNull: false;
|
|
311
|
+
hasDefault: false;
|
|
312
|
+
isPrimaryKey: false;
|
|
313
|
+
isAutoincrement: false;
|
|
314
|
+
hasRuntimeDefault: false;
|
|
315
|
+
enumValues: undefined;
|
|
316
|
+
baseColumn: never;
|
|
317
|
+
identity: undefined;
|
|
318
|
+
generated: undefined;
|
|
319
|
+
}, {}, {}>;
|
|
320
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
321
|
+
name: "created_at";
|
|
322
|
+
tableName: "schedules";
|
|
323
|
+
dataType: "date";
|
|
324
|
+
columnType: "PgTimestamp";
|
|
325
|
+
data: Date;
|
|
326
|
+
driverParam: string;
|
|
327
|
+
notNull: true;
|
|
328
|
+
hasDefault: false;
|
|
329
|
+
isPrimaryKey: false;
|
|
330
|
+
isAutoincrement: false;
|
|
331
|
+
hasRuntimeDefault: false;
|
|
332
|
+
enumValues: undefined;
|
|
333
|
+
baseColumn: never;
|
|
334
|
+
identity: undefined;
|
|
335
|
+
generated: undefined;
|
|
336
|
+
}, {}, {}>;
|
|
337
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
338
|
+
name: "updated_at";
|
|
339
|
+
tableName: "schedules";
|
|
340
|
+
dataType: "date";
|
|
341
|
+
columnType: "PgTimestamp";
|
|
342
|
+
data: Date;
|
|
343
|
+
driverParam: string;
|
|
344
|
+
notNull: true;
|
|
345
|
+
hasDefault: false;
|
|
346
|
+
isPrimaryKey: false;
|
|
347
|
+
isAutoincrement: false;
|
|
348
|
+
hasRuntimeDefault: false;
|
|
349
|
+
enumValues: undefined;
|
|
350
|
+
baseColumn: never;
|
|
351
|
+
identity: undefined;
|
|
352
|
+
generated: undefined;
|
|
353
|
+
}, {}, {}>;
|
|
354
|
+
};
|
|
355
|
+
dialect: "pg";
|
|
356
|
+
}>;
|
|
265
357
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,gDAAmB,CAAC;AAE3C,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBf,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,gDAAmB,CAAC;AAE3C,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBf,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC;AAE9C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMpB,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Drizzle view of the module's
|
|
1
|
+
// Drizzle view of the module's tables (migrations/). The migrations are the source of truth; this
|
|
2
2
|
// file only types the queries.
|
|
3
3
|
import { bigint, integer, jsonb, pgSchema, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
4
4
|
export const jobsSchema = pgSchema("jobs");
|
|
@@ -19,4 +19,11 @@ export const jobs = jobsSchema.table("jobs", {
|
|
|
19
19
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
20
20
|
finishedAt: timestamp("finished_at", { withTimezone: true }),
|
|
21
21
|
});
|
|
22
|
+
export const schedules = jobsSchema.table("schedules", {
|
|
23
|
+
name: text("name").primaryKey(),
|
|
24
|
+
lastSlotAt: timestamp("last_slot_at", { withTimezone: true }).notNull(),
|
|
25
|
+
lastSucceededAt: timestamp("last_succeeded_at", { withTimezone: true }),
|
|
26
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
27
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull(),
|
|
28
|
+
});
|
|
22
29
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,+BAA+B;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAA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E,CAAC,CAAC,OAAO,EAAE;IACpE,UAAU,EAAE,SAAS,CAAC,aAAa,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE;IACrD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE;IAC/B,UAAU,EAAE,SAAS,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IACvE,eAAe,EAAE,SAAS,CAAC,mBAAmB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACvE,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IACpE,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;CACrE,CAAC,CAAC"}
|
package/dist/server/claim.d.ts
CHANGED
|
@@ -32,7 +32,10 @@ export type Completion = {
|
|
|
32
32
|
export declare function claimJobs(ctx: JobsContext, input: ClaimJobsInput): Promise<ClaimedJob[]>;
|
|
33
33
|
/** Pushes the lease of a held job forward. False when the job is no longer this claim's: stop working on it. */
|
|
34
34
|
export declare function extendJobLease(ctx: JobsContext, claimed: ClaimedJob): Promise<boolean>;
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Records the end of an attempt; a success of a scheduled queue also updates its schedule, in the same transaction.
|
|
37
|
+
* False when the job is no longer this claim's: nothing was written.
|
|
38
|
+
*/
|
|
36
39
|
export declare function completeJob(ctx: JobsContext, claimed: ClaimedJob, completion: Completion): Promise<boolean>;
|
|
37
40
|
/**
|
|
38
41
|
* Gives a held job back without an outcome (the worker is stopping): pending again, due now, and the attempt is not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim.d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GAAG,OAAO,CAAC,OAAO,CAAC,CAS5F;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAejH;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBxF"}
|
package/dist/server/claim.js
CHANGED
|
@@ -4,6 +4,7 @@ import { and, asc, eq, gte, inArray, lte, or, sql } from "drizzle-orm";
|
|
|
4
4
|
import { jobs } from "../schema.js";
|
|
5
5
|
import { toJob } from "./job-row.js";
|
|
6
6
|
import { getJobsOptions, getQueue } from "./options.js";
|
|
7
|
+
import { recordScheduleSuccess } from "./schedules.js";
|
|
7
8
|
const LEASE_EXPIRED = "jobs.lease_expired";
|
|
8
9
|
/**
|
|
9
10
|
* Claims up to `limit` due jobs of one queue, oldest due first: pending jobs whose `run_at` has come and running jobs
|
|
@@ -51,7 +52,10 @@ export async function extendJobLease(ctx, claimed) {
|
|
|
51
52
|
.returning();
|
|
52
53
|
return rows.length > 0;
|
|
53
54
|
}
|
|
54
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Records the end of an attempt; a success of a scheduled queue also updates its schedule, in the same transaction.
|
|
57
|
+
* False when the job is no longer this claim's: nothing was written.
|
|
58
|
+
*/
|
|
55
59
|
export async function completeJob(ctx, claimed, completion) {
|
|
56
60
|
const now = ctx.clock.now();
|
|
57
61
|
const unlocked = { lockedUntil: null, lockedBy: null, claimToken: null, updatedAt: now };
|
|
@@ -60,8 +64,14 @@ export async function completeJob(ctx, claimed, completion) {
|
|
|
60
64
|
: completion.kind === "retry"
|
|
61
65
|
? { ...unlocked, status: "pending", runAt: completion.runAt, lastError: completion.error }
|
|
62
66
|
: { ...unlocked, status: "failed", finishedAt: now, lastError: completion.error };
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
return ctx.db.transaction(async (tx) => {
|
|
68
|
+
const rows = await tx.update(jobs).set(set).where(isHeld(claimed)).returning();
|
|
69
|
+
if (rows.length === 0)
|
|
70
|
+
return false;
|
|
71
|
+
if (completion.kind === "succeeded")
|
|
72
|
+
await recordScheduleSuccess({ ...ctx, db: tx }, claimed.job.queue);
|
|
73
|
+
return true;
|
|
74
|
+
});
|
|
65
75
|
}
|
|
66
76
|
/**
|
|
67
77
|
* Gives a held job back without an outcome (the worker is stopping): pending again, due now, and the attempt is not
|
package/dist/server/claim.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/server/claim.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,qGAAqG;AACrG,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../src/server/claim.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,qGAAqG;AACrG,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AA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AQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,GAAG;KACf,CAAC;SACD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACrI,CAAC;AAED,SAAS,MAAM,CAAC,OAAmB;IACjC,OAAO,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AACvH,CAAC;AAED,SAAS,YAAY,CAAC,KAAoB;IACxC,IAAI,KAAK,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC1F,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export { consoleJobsLogger, type JobsLogFields, type JobsLogger } from "./logger
|
|
|
6
6
|
export { getQueueStats, pruneJobs, type QueueStats } from "./maintenance.js";
|
|
7
7
|
export { getJobsOptions } from "./options.js";
|
|
8
8
|
export { runClaimedJob, type RunClaimedJobOptions } from "./process.js";
|
|
9
|
+
export { enqueueDueSchedules, getScheduleSlot, SCHEDULE_DEDUP_KEY, type EnqueueDueSchedulesInput, type ScheduleState, } from "./schedules.js";
|
|
9
10
|
export { runDueJobs, type RunDueJobsOptions, type RunDueJobsReport } from "./run-due.js";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -7,5 +7,6 @@ export { consoleJobsLogger } from "./logger.js";
|
|
|
7
7
|
export { getQueueStats, pruneJobs } from "./maintenance.js";
|
|
8
8
|
export { getJobsOptions } from "./options.js";
|
|
9
9
|
export { runClaimedJob } from "./process.js";
|
|
10
|
+
export { enqueueDueSchedules, getScheduleSlot, SCHEDULE_DEDUP_KEY, } from "./schedules.js";
|
|
10
11
|
export { runDueJobs } from "./run-due.js";
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,8BAA8B;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAA6C,MAAM,YAAY,CAAC;AACpG,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,UAAU,GAIX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAA0C,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAuC,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAA6B,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,UAAU,EAAiD,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,8BAA8B;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAA6C,MAAM,YAAY,CAAC;AACpG,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,UAAU,GAIX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAA0C,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAuC,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAA6B,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAiD,MAAM,cAAc,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type JobStatus } from "../contract.js";
|
|
2
2
|
import type { JobsContext } from "./context.js";
|
|
3
|
+
import { type ScheduleState } from "./schedules.js";
|
|
3
4
|
/**
|
|
4
5
|
* Deletes succeeded, failed and cancelled jobs older (by `finished_at`) than their retention, in batches. Returns the
|
|
5
6
|
* number of deleted jobs. The worker calls it once an hour; an app without a worker may call it from a cron.
|
|
@@ -13,10 +14,12 @@ export interface QueueStats {
|
|
|
13
14
|
readonly due: number;
|
|
14
15
|
/** The `run_at` of the oldest due pending job, or null: how far behind the workers are. */
|
|
15
16
|
readonly oldestDueAt: Date | null;
|
|
17
|
+
/** The queue's schedule, when `schedules` names it: when it last ran and whether it is late. */
|
|
18
|
+
readonly schedule: ScheduleState | null;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
18
|
-
* Counts per queue: every configured queue, plus any queue that still has rows in the table
|
|
19
|
-
* script or a health check of the app's own (`ops({ checks })`).
|
|
21
|
+
* Counts per queue: every configured queue, plus any queue that still has rows in the table, with the state of its
|
|
22
|
+
* schedule. For a dashboard, an ops script or a health check of the app's own (`ops({ checks })`).
|
|
20
23
|
*/
|
|
21
24
|
export declare function getQueueStats(ctx: JobsContext): Promise<QueueStats[]>;
|
|
22
25
|
//# sourceMappingURL=maintenance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maintenance.d.ts","sourceRoot":"","sources":["../../src/server/maintenance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"maintenance.d.ts","sourceRoot":"","sources":["../../src/server/maintenance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMvE;;;GAGG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBjE;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,4FAA4F;IAC5F,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAoB3E"}
|
|
@@ -3,6 +3,7 @@ import { and, eq, inArray, lt, min, or, sql } from "drizzle-orm";
|
|
|
3
3
|
import { JOB_STATUSES } from "../contract.js";
|
|
4
4
|
import { jobs } from "../schema.js";
|
|
5
5
|
import { getJobsOptions } from "./options.js";
|
|
6
|
+
import { getScheduleStates } from "./schedules.js";
|
|
6
7
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
7
8
|
/** Rows deleted per statement, so pruning a large backlog never holds one long lock. */
|
|
8
9
|
const PRUNE_BATCH = 1000;
|
|
@@ -25,8 +26,8 @@ export async function pruneJobs(ctx) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* Counts per queue: every configured queue, plus any queue that still has rows in the table
|
|
29
|
-
* script or a health check of the app's own (`ops({ checks })`).
|
|
29
|
+
* Counts per queue: every configured queue, plus any queue that still has rows in the table, with the state of its
|
|
30
|
+
* schedule. For a dashboard, an ops script or a health check of the app's own (`ops({ checks })`).
|
|
30
31
|
*/
|
|
31
32
|
export async function getQueueStats(ctx) {
|
|
32
33
|
const now = ctx.clock.now();
|
|
@@ -39,13 +40,14 @@ export async function getQueueStats(ctx) {
|
|
|
39
40
|
.from(jobs)
|
|
40
41
|
.where(and(eq(jobs.status, "pending"), sql `${jobs.runAt} <= ${now}`))
|
|
41
42
|
.groupBy(jobs.queue);
|
|
43
|
+
const scheduleStates = await getScheduleStates(ctx);
|
|
42
44
|
const names = new Set([...Object.keys(getJobsOptions(ctx.config).queues), ...counted.map((row) => row.queue)]);
|
|
43
45
|
return [...names].map((queue) => {
|
|
44
46
|
const counts = Object.fromEntries(JOB_STATUSES.map((status) => [status, 0]));
|
|
45
47
|
for (const row of counted.filter((candidate) => candidate.queue === queue))
|
|
46
48
|
counts[row.status] = row.count;
|
|
47
49
|
const due = backlog.find((row) => row.queue === queue);
|
|
48
|
-
return { queue, counts, due: due?.due ?? 0, oldestDueAt: due?.oldestDueAt ?? null };
|
|
50
|
+
return { queue, counts, due: due?.due ?? 0, oldestDueAt: due?.oldestDueAt ?? null, schedule: scheduleStates.get(queue) ?? null };
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
//# sourceMappingURL=maintenance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maintenance.js","sourceRoot":"","sources":["../../src/server/maintenance.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"maintenance.js","sourceRoot":"","sources":["../../src/server/maintenance.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,E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runs of the schedules among its queues, then claims and runs due jobs until none is due (a retried job is due later, so it waits for the clock). Returns what
|
|
25
25
|
* happened. Throws on a handler for a queue the config does not define; database failures propagate.
|
|
26
26
|
*/
|
|
27
27
|
export declare function runDueJobs(ctx: JobsContext, options: RunDueJobsOptions): Promise<RunDueJobsReport>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-due.d.ts","sourceRoot":"","sources":["../../src/server/run-due.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"run-due.d.ts","sourceRoot":"","sources":["../../src/server/run-due.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AASjE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IAC/B,4GAA4G;IAC5G,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA0BxG"}
|
package/dist/server/run-due.js
CHANGED
|
@@ -3,14 +3,16 @@ import { consoleJobsLogger } from "./logger.js";
|
|
|
3
3
|
import { getJobsOptions } from "./options.js";
|
|
4
4
|
import { runClaimedJob } from "./process.js";
|
|
5
5
|
import { checkHandlers } from "./handler-check.js";
|
|
6
|
+
import { enqueueDueSchedules } from "./schedules.js";
|
|
6
7
|
const DEFAULT_MAX_JOBS = 1000;
|
|
7
8
|
const NEVER_ABORTED = new AbortController().signal;
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Enqueues the due runs of the schedules among its queues, then claims and runs due jobs until none is due (a retried job is due later, so it waits for the clock). Returns what
|
|
10
11
|
* happened. Throws on a handler for a queue the config does not define; database failures propagate.
|
|
11
12
|
*/
|
|
12
13
|
export async function runDueJobs(ctx, options) {
|
|
13
14
|
const queues = checkHandlers(getJobsOptions(ctx.config), options.handlers, options.queues);
|
|
15
|
+
await enqueueDueSchedules(ctx, { queues });
|
|
14
16
|
const report = { succeeded: 0, retried: 0, failed: 0, stale: 0 };
|
|
15
17
|
const maxJobs = options.maxJobs ?? DEFAULT_MAX_JOBS;
|
|
16
18
|
const runOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-due.js","sourceRoot":"","sources":["../../src/server/run-due.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAmB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE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ACtC,CAAC;IACF,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,UAAU,GAAG,IAAI,CAAC;IACtB,OAAO,UAAU,IAAI,QAAQ,GAAG,OAAO,EAAE,CAAC;QACxC,UAAU,GAAG,KAAK,CAAC;QACnB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,cAAc,EAAE,CAAC,CAAC;YAC1G,IAAI,OAAO,KAAK,SAAS;gBAAE,SAAS;YACpC,UAAU,GAAG,IAAI,CAAC;YAClB,QAAQ,IAAI,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAC9D,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,IAAI,QAAQ,IAAI,OAAO;gBAAE,MAAM;QACjC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type JobScheduleOptions, type JobsOptions } from "../options.js";
|
|
2
|
+
import type { JobsContext } from "./context.js";
|
|
3
|
+
/**
|
|
4
|
+
* The dedup key of every scheduled run: while one run of a schedule is pending or running (retrying a failure, say),
|
|
5
|
+
* the next period joins it instead of piling up a second run behind it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCHEDULE_DEDUP_KEY = "schedule";
|
|
8
|
+
/** A schedule's health as `getQueueStats` reports it. */
|
|
9
|
+
export interface ScheduleState {
|
|
10
|
+
/** The period; for a local-time schedule the longest gap between two of its times of day (24h for one time). */
|
|
11
|
+
readonly everySeconds: number;
|
|
12
|
+
/** The start of the latest period a run was enqueued for; null before any worker saw the schedule. */
|
|
13
|
+
readonly lastEnqueuedAt: Date | null;
|
|
14
|
+
/** When a job of the schedule's queue last succeeded; null when none has yet. */
|
|
15
|
+
readonly lastSucceededAt: Date | null;
|
|
16
|
+
/**
|
|
17
|
+
* True when no run succeeded within two periods (counted from when a worker first saw the schedule), or no worker
|
|
18
|
+
* has seen it at all: no worker runs its queue, or its runs keep failing.
|
|
19
|
+
*/
|
|
20
|
+
readonly isLate: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface EnqueueDueSchedulesInput {
|
|
23
|
+
/** Only the schedules of these queues; default every schedule. */
|
|
24
|
+
readonly queues?: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The slot `now` falls in: the start of its period, or the latest of the schedule's local times at or before `now`.
|
|
28
|
+
* Slots only move forward as `now` does, across DST changes too.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getScheduleSlot(schedule: JobScheduleOptions, now: Date): Date;
|
|
31
|
+
/**
|
|
32
|
+
* Enqueues a run for every schedule whose current period has none yet, and returns their queue names. Missed periods
|
|
33
|
+
* (no worker ran) collapse into one run for the current period. The worker calls it; an app that drains its queues
|
|
34
|
+
* from a cron (`runDueJobs`) gets it from there. Database failures propagate.
|
|
35
|
+
*/
|
|
36
|
+
export declare function enqueueDueSchedules(ctx: JobsContext, input?: EnqueueDueSchedulesInput): Promise<string[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Takes `slot` for the schedule `name` and enqueues its run, in one transaction. False when the schedule already has
|
|
39
|
+
* this period or a later one (another worker took it). Throws on a name that is not a schedule.
|
|
40
|
+
*/
|
|
41
|
+
export declare function enqueueScheduledRun(ctx: JobsContext, name: string, slot: Date): Promise<boolean>;
|
|
42
|
+
/** Notes a succeeded job of a scheduled queue (any job of it, a run enqueued by hand too). */
|
|
43
|
+
export declare function recordScheduleSuccess(ctx: JobsContext, queue: string): Promise<void>;
|
|
44
|
+
/** The state of every configured schedule, by queue name. */
|
|
45
|
+
export declare function getScheduleStates(ctx: JobsContext): Promise<Map<string, ScheduleState>>;
|
|
46
|
+
/** The schedules among `queues` (default all), in configuration order. */
|
|
47
|
+
export declare function getScheduleNames(options: JobsOptions, queues: readonly string[] | undefined): string[];
|
|
48
|
+
export declare function getSchedule(options: JobsOptions, name: string): JobScheduleOptions;
|
|
49
|
+
//# sourceMappingURL=schedules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../src/server/schedules.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAiC,MAAM,eAAe,CAAC;AAG5H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC5B,gHAAgH;IAChH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sGAAsG;IACtG,QAAQ,CAAC,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;IACrC,iFAAiF;IACjF,QAAQ,CAAC,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,CAI7E;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,GAAE,wBAA6B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnH;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBtG;AAED,8FAA8F;AAC9F,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1F;AAED,6DAA6D;AAC7D,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAe7F;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAEtG;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAIlF"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Recurring schedules: a period schedule's runs start on whole periods counted from the Unix epoch, a local-time
|
|
2
|
+
// schedule's at its listed times of day in its time zone, so every worker computes the same slot. A worker takes a period with a conditional upsert of `jobs.schedules` and enqueues its run
|
|
3
|
+
// in the same transaction, so each period is enqueued once however many workers race for it.
|
|
4
|
+
import { eq, inArray, lt } from "drizzle-orm";
|
|
5
|
+
import { parseEverySeconds } from "../options.js";
|
|
6
|
+
import { schedules } from "../schema.js";
|
|
7
|
+
import { getWallClock, getZonedInstant } from "../zoned-time.js";
|
|
8
|
+
import { enqueueJob } from "./enqueue.js";
|
|
9
|
+
import { getJobsOptions } from "./options.js";
|
|
10
|
+
/**
|
|
11
|
+
* The dedup key of every scheduled run: while one run of a schedule is pending or running (retrying a failure, say),
|
|
12
|
+
* the next period joins it instead of piling up a second run behind it.
|
|
13
|
+
*/
|
|
14
|
+
export const SCHEDULE_DEDUP_KEY = "schedule";
|
|
15
|
+
/**
|
|
16
|
+
* The slot `now` falls in: the start of its period, or the latest of the schedule's local times at or before `now`.
|
|
17
|
+
* Slots only move forward as `now` does, across DST changes too.
|
|
18
|
+
*/
|
|
19
|
+
export function getScheduleSlot(schedule, now) {
|
|
20
|
+
if ("at" in schedule)
|
|
21
|
+
return new Date(getLocalTimeSlot(schedule, now.getTime()));
|
|
22
|
+
const periodMs = getEverySeconds(schedule) * 1000;
|
|
23
|
+
return new Date(Math.floor(now.getTime() / periodMs) * periodMs);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Enqueues a run for every schedule whose current period has none yet, and returns their queue names. Missed periods
|
|
27
|
+
* (no worker ran) collapse into one run for the current period. The worker calls it; an app that drains its queues
|
|
28
|
+
* from a cron (`runDueJobs`) gets it from there. Database failures propagate.
|
|
29
|
+
*/
|
|
30
|
+
export async function enqueueDueSchedules(ctx, input = {}) {
|
|
31
|
+
const options = getJobsOptions(ctx.config);
|
|
32
|
+
const enqueued = [];
|
|
33
|
+
for (const name of getScheduleNames(options, input.queues)) {
|
|
34
|
+
const slot = getScheduleSlot(getSchedule(options, name), ctx.clock.now());
|
|
35
|
+
if (await enqueueScheduledRun(ctx, name, slot))
|
|
36
|
+
enqueued.push(name);
|
|
37
|
+
}
|
|
38
|
+
return enqueued;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Takes `slot` for the schedule `name` and enqueues its run, in one transaction. False when the schedule already has
|
|
42
|
+
* this period or a later one (another worker took it). Throws on a name that is not a schedule.
|
|
43
|
+
*/
|
|
44
|
+
export async function enqueueScheduledRun(ctx, name, slot) {
|
|
45
|
+
const schedule = getSchedule(getJobsOptions(ctx.config), name);
|
|
46
|
+
const now = ctx.clock.now();
|
|
47
|
+
return ctx.db.transaction(async (tx) => {
|
|
48
|
+
const [taken] = await tx
|
|
49
|
+
.insert(schedules)
|
|
50
|
+
.values({ name, lastSlotAt: slot, createdAt: now, updatedAt: now })
|
|
51
|
+
.onConflictDoUpdate({
|
|
52
|
+
target: schedules.name,
|
|
53
|
+
set: { lastSlotAt: slot, updatedAt: now },
|
|
54
|
+
setWhere: lt(schedules.lastSlotAt, slot),
|
|
55
|
+
})
|
|
56
|
+
.returning({ name: schedules.name });
|
|
57
|
+
if (taken === undefined)
|
|
58
|
+
return false;
|
|
59
|
+
await enqueueJob({ ...ctx, db: tx }, { queue: name, payload: schedule.payload, dedupKey: SCHEDULE_DEDUP_KEY });
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Notes a succeeded job of a scheduled queue (any job of it, a run enqueued by hand too). */
|
|
64
|
+
export async function recordScheduleSuccess(ctx, queue) {
|
|
65
|
+
if (!Object.hasOwn(getJobsOptions(ctx.config).schedules, queue))
|
|
66
|
+
return;
|
|
67
|
+
const now = ctx.clock.now();
|
|
68
|
+
await ctx.db.update(schedules).set({ lastSucceededAt: now, updatedAt: now }).where(eq(schedules.name, queue));
|
|
69
|
+
}
|
|
70
|
+
/** The state of every configured schedule, by queue name. */
|
|
71
|
+
export async function getScheduleStates(ctx) {
|
|
72
|
+
const options = getJobsOptions(ctx.config);
|
|
73
|
+
const names = Object.keys(options.schedules);
|
|
74
|
+
if (names.length === 0)
|
|
75
|
+
return new Map();
|
|
76
|
+
const rows = await ctx.db.select().from(schedules).where(inArray(schedules.name, names));
|
|
77
|
+
const now = ctx.clock.now().getTime();
|
|
78
|
+
return new Map(names.map((name) => {
|
|
79
|
+
const everySeconds = getEverySeconds(getSchedule(options, name));
|
|
80
|
+
const row = rows.find((candidate) => candidate.name === name);
|
|
81
|
+
const since = row?.lastSucceededAt ?? row?.createdAt ?? null;
|
|
82
|
+
const isLate = since === null || now - since.getTime() > 2 * everySeconds * 1000;
|
|
83
|
+
return [name, { everySeconds, lastEnqueuedAt: row?.lastSlotAt ?? null, lastSucceededAt: row?.lastSucceededAt ?? null, isLate }];
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
/** The schedules among `queues` (default all), in configuration order. */
|
|
87
|
+
export function getScheduleNames(options, queues) {
|
|
88
|
+
return Object.keys(options.schedules).filter((name) => queues === undefined || queues.includes(name));
|
|
89
|
+
}
|
|
90
|
+
export function getSchedule(options, name) {
|
|
91
|
+
const schedule = Object.hasOwn(options.schedules, name) ? options.schedules[name] : undefined;
|
|
92
|
+
if (schedule === undefined)
|
|
93
|
+
throw new Error(`@softure-ai/jobs: "${name}" is not a configured schedule`);
|
|
94
|
+
return schedule;
|
|
95
|
+
}
|
|
96
|
+
function getEverySeconds(schedule) {
|
|
97
|
+
if ("at" in schedule)
|
|
98
|
+
return getLongestGapSeconds(schedule.at);
|
|
99
|
+
const seconds = parseEverySeconds(schedule.every);
|
|
100
|
+
// The options schema refused any other value at startup.
|
|
101
|
+
if (seconds === null)
|
|
102
|
+
throw new Error(`@softure-ai/jobs: invalid schedule period "${schedule.every}"`);
|
|
103
|
+
return seconds;
|
|
104
|
+
}
|
|
105
|
+
function getLocalTimeSlot(schedule, now) {
|
|
106
|
+
const today = getWallClock(now, schedule.timeZone);
|
|
107
|
+
// The calendar day before today's local date; Date.UTC rolls day 0 over to the month before.
|
|
108
|
+
const yesterday = new Date(Date.UTC(today.year, today.month - 1, today.day - 1));
|
|
109
|
+
const days = [
|
|
110
|
+
{ year: yesterday.getUTCFullYear(), month: yesterday.getUTCMonth() + 1, day: yesterday.getUTCDate() },
|
|
111
|
+
{ year: today.year, month: today.month, day: today.day },
|
|
112
|
+
];
|
|
113
|
+
let slot = Number.NEGATIVE_INFINITY;
|
|
114
|
+
for (const day of days) {
|
|
115
|
+
for (const time of schedule.at) {
|
|
116
|
+
const [hour, minute] = time.split(":").map(Number);
|
|
117
|
+
const instant = getZonedInstant({ ...day, hour: hour ?? 0, minute: minute ?? 0 }, schedule.timeZone);
|
|
118
|
+
if (instant <= now && instant > slot)
|
|
119
|
+
slot = instant;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return slot;
|
|
123
|
+
}
|
|
124
|
+
/** The longest gap between two consecutive times of day, wrapping past midnight; `times` is sorted. */
|
|
125
|
+
function getLongestGapSeconds(times) {
|
|
126
|
+
const minutes = times.map((time) => {
|
|
127
|
+
const [hour, minute] = time.split(":").map(Number);
|
|
128
|
+
return (hour ?? 0) * 60 + (minute ?? 0);
|
|
129
|
+
});
|
|
130
|
+
const gaps = minutes.map((minute, index) => (minutes[(index + 1) % minutes.length] ?? minute) - minute + (index === minutes.length - 1 ? 24 * 60 : 0));
|
|
131
|
+
return Math.max(...gaps) * 60;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=schedules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/server/schedules.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,6LAA6L;AAC7L,6FAA6F;AAC7F,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAA4E,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAsB7C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAA4B,EAAE,GAAS;IACrE,IAAI,IAAI,IAAI,QAAQ;QAAE,OAAO,IAAI,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACjF,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAClD,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;AACnE,CAAC;AA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M,GAAG,CAAC,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvJ,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-job-worker.d.ts","sourceRoot":"","sources":["../../src/worker/run-job-worker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-job-worker.d.ts","sourceRoot":"","sources":["../../src/worker/run-job-worker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUzE,MAAM,WAAW,mBAAmB;IAClC,oHAAoH;IACpH,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC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