@ddd-ts-kit/scheduling 0.113.2 → 0.115.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/README.fr.md +8 -6
- package/README.md +6 -5
- package/dist/in-process-job-scheduler.d.ts +7 -7
- package/dist/in-process-job-scheduler.d.ts.map +1 -1
- package/dist/in-process-job-scheduler.js +50 -75
- package/dist/in-process-job-scheduler.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/job-recorder.d.ts +1 -1
- package/dist/job-recorder.d.ts.map +1 -1
- package/dist/job-recorder.js +6 -14
- package/dist/job-recorder.js.map +1 -1
- package/dist/job-runner.d.ts.map +1 -1
- package/dist/job-runner.js +3 -7
- package/dist/job-runner.js.map +1 -1
- package/dist/queue/background-job-recorder.d.ts +1 -1
- package/dist/queue/background-job-recorder.d.ts.map +1 -1
- package/dist/queue/background-job-recorder.js +5 -13
- package/dist/queue/background-job-recorder.js.map +1 -1
- package/dist/queue/claimed-job-runner.d.ts.map +1 -1
- package/dist/queue/claimed-job-runner.js +5 -6
- package/dist/queue/claimed-job-runner.js.map +1 -1
- package/dist/queue/followed-queue.d.ts +38 -0
- package/dist/queue/followed-queue.d.ts.map +1 -0
- package/dist/queue/followed-queue.js +82 -0
- package/dist/queue/followed-queue.js.map +1 -0
- package/dist/queue/queue-worker.d.ts.map +1 -1
- package/dist/queue/queue-worker.js +12 -30
- package/dist/queue/queue-worker.js.map +1 -1
- package/dist/queue/running-job.d.ts +1 -3
- package/dist/queue/running-job.d.ts.map +1 -1
- package/dist/queue/store/claimed-job.d.ts +4 -1
- package/dist/queue/store/claimed-job.d.ts.map +1 -1
- package/dist/queue/store/in-memory-job-store.d.ts +4 -2
- package/dist/queue/store/in-memory-job-store.d.ts.map +1 -1
- package/dist/queue/store/in-memory-job-store.js +12 -4
- package/dist/queue/store/in-memory-job-store.js.map +1 -1
- package/dist/queue/store/job-lease.d.ts +10 -4
- package/dist/queue/store/job-lease.d.ts.map +1 -1
- package/dist/queue/store/job-lease.js +23 -1
- package/dist/queue/store/job-lease.js.map +1 -1
- package/dist/queue/store/job-store.d.ts +13 -8
- package/dist/queue/store/job-store.d.ts.map +1 -1
- package/dist/queue/store/job-store.js +4 -3
- package/dist/queue/store/job-store.js.map +1 -1
- package/dist/queue/store/stored-job.d.ts +2 -0
- package/dist/queue/store/stored-job.d.ts.map +1 -1
- package/dist/registered-job.d.ts +65 -10
- package/dist/registered-job.d.ts.map +1 -1
- package/dist/registered-job.js +121 -3
- package/dist/registered-job.js.map +1 -1
- package/package.json +6 -6
- package/dist/queue/queue-state.d.ts +0 -14
- package/dist/queue/queue-state.d.ts.map +0 -1
- package/dist/queue/queue-state.js +0 -2
- package/dist/queue/queue-state.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-job-store.js","sourceRoot":"","sources":["../../../src/queue/store/in-memory-job-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"in-memory-job-store.js","sourceRoot":"","sources":["../../../src/queue/store/in-memory-job-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoC,MAAM,oBAAoB,CAAC;AAIrF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,QAAQ,GAAsB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IACV,IAAI,GAAG,IAAI,GAAG,EAAqB,CAAC;IAE7C,QAAQ,GAAG,CAAC,CAAC;IAErB,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,MAAM,Q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,CAAC;QAC3C,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC;QAC3C,GAAG,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;KACnF,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The fence of a claimed job: who may still report on it. The store mints one at each claim, out
|
|
3
|
+
* of a count of the claims of the job that only grows, so no two claims of a job ever hold the
|
|
4
|
+
* same lease. An attempt number cannot be that fence: a release gives it back and a revival
|
|
5
|
+
* starts it again. A run whose job was claimed again holds an older lease, and the store ignores it.
|
|
4
6
|
*/
|
|
5
|
-
export
|
|
7
|
+
export declare class JobLease {
|
|
6
8
|
readonly id: string;
|
|
7
|
-
|
|
9
|
+
/** The claim it is of: 1 for the first claim of the job, one more at each claim, never given back. */
|
|
10
|
+
readonly claim: number;
|
|
11
|
+
private constructor();
|
|
12
|
+
/** For a store, when it claims: `claim` is how many times the job was claimed, this time counted. */
|
|
13
|
+
static ofClaim(id: string, claim: number): JobLease;
|
|
8
14
|
}
|
|
9
15
|
//# sourceMappingURL=job-lease.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-lease.d.ts","sourceRoot":"","sources":["../../../src/queue/store/job-lease.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"job-lease.d.ts","sourceRoot":"","sources":["../../../src/queue/store/job-lease.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,QAAQ;IAEjB,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,sGAAsG;IACtG,QAAQ,CAAC,KAAK,EAAE,MAAM;IAHxB,OAAO,eAIH;IAEJ,qGAAqG;IACrG,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAMlD;CACF"}
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The fence of a claimed job: who may still report on it. The store mints one at each claim, out
|
|
3
|
+
* of a count of the claims of the job that only grows, so no two claims of a job ever hold the
|
|
4
|
+
* same lease. An attempt number cannot be that fence: a release gives it back and a revival
|
|
5
|
+
* starts it again. A run whose job was claimed again holds an older lease, and the store ignores it.
|
|
6
|
+
*/
|
|
7
|
+
export class JobLease {
|
|
8
|
+
id;
|
|
9
|
+
claim;
|
|
10
|
+
constructor(id,
|
|
11
|
+
/** The claim it is of: 1 for the first claim of the job, one more at each claim, never given back. */
|
|
12
|
+
claim) {
|
|
13
|
+
this.id = id;
|
|
14
|
+
this.claim = claim;
|
|
15
|
+
}
|
|
16
|
+
/** For a store, when it claims: `claim` is how many times the job was claimed, this time counted. */
|
|
17
|
+
static ofClaim(id, claim) {
|
|
18
|
+
if (!Number.isSafeInteger(claim) || claim < 1) {
|
|
19
|
+
throw new RangeError(`The lease of job ${id} is of a claim counted from 1, not of ${String(claim)}.`);
|
|
20
|
+
}
|
|
21
|
+
return new JobLease(id, claim);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
2
24
|
//# sourceMappingURL=job-lease.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-lease.js","sourceRoot":"","sources":["../../../src/queue/store/job-lease.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"job-lease.js","sourceRoot":"","sources":["../../../src/queue/store/job-lease.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IAER,EAAE;IAEF,KAAK;IAHhB,YACW,EAAU;IACnB,sGAAsG;IAC7F,KAAa;kBAFb,EAAE;qBAEF,KAAK;IACb,CAAC;IAEJ,qGAAqG;IACrG,MAAM,CAAC,OAAO,CAAC,EAAU,EAAE,KAAa;QACtC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,UAAU,CAAC,oBAAoB,EAAE,yCAAyC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxG,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -10,23 +10,25 @@ import type { NewJob } from './new-job.js';
|
|
|
10
10
|
* Where background jobs wait between `enqueue` and their run, and what a worker reports of them.
|
|
11
11
|
*
|
|
12
12
|
* A claim is a lease: a job claimed and not heard of before its lease ends is claimed again,
|
|
13
|
-
* which is how the jobs of a worker that died come back. Every report names the
|
|
14
|
-
*
|
|
15
|
-
* the worker stops. Every write answers false
|
|
13
|
+
* which is how the jobs of a worker that died come back. Every report names the lease its claim
|
|
14
|
+
* was handed (`JobLease`), which no other claim of the job ever holds: once the job was claimed
|
|
15
|
+
* again, or cancelled, the store answers false and the worker stops. Every write answers false
|
|
16
|
+
* when it changed nothing.
|
|
16
17
|
*/
|
|
17
18
|
export declare abstract class JobStore {
|
|
18
19
|
static readonly tokenKey = "scheduling.JobStore";
|
|
19
20
|
/**
|
|
20
21
|
* Adds the job, in the transaction of the caller when the store is transactional. A job of the
|
|
21
|
-
* same name, tenant and idempotency key already kept is answered instead, `duplicate: true
|
|
22
|
+
* same name, tenant and idempotency key already kept is answered instead, `duplicate: true`;
|
|
23
|
+
* so is a job already kept under the same id, which stays as it was added. Neither raises.
|
|
22
24
|
* A store that writes after the commit checks the key before: two jobs of one key staged
|
|
23
25
|
* before either committed both answer their own id, and only the first is kept.
|
|
24
26
|
*/
|
|
25
27
|
abstract add(job: NewJob): Promise<EnqueuedJob>;
|
|
26
28
|
/**
|
|
27
29
|
* Claims up to `limit` jobs of the queue that are due (waiting with `runAt` passed, or running
|
|
28
|
-
* with an expired lease), the earliest first,
|
|
29
|
-
* never return the same job.
|
|
30
|
+
* with an expired lease), the earliest first, counts the attempt and hands each job under a
|
|
31
|
+
* lease of its own. Two concurrent claims never return the same job.
|
|
30
32
|
*/
|
|
31
33
|
abstract claim(request: ClaimRequest): Promise<ClaimedJob[]>;
|
|
32
34
|
/** Extends the lease while the run goes on. False: the job was cancelled or claimed again. */
|
|
@@ -36,7 +38,10 @@ export declare abstract class JobStore {
|
|
|
36
38
|
abstract complete(lease: JobLease, at: Date): Promise<boolean>;
|
|
37
39
|
/** Schedules the next attempt, or declares the job dead when `retryAt` is null. */
|
|
38
40
|
abstract fail(lease: JobLease, failure: JobFailure): Promise<boolean>;
|
|
39
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Gives a job back without counting the attempt: the worker stops before the run could end.
|
|
43
|
+
* The lease is not given back: the next claim holds another.
|
|
44
|
+
*/
|
|
40
45
|
abstract release(lease: JobLease, runAt: Date): Promise<boolean>;
|
|
41
46
|
/**
|
|
42
47
|
* A waiting or running job is cancelled: a running one learns it at its next heartbeat. In
|
|
@@ -44,7 +49,7 @@ export declare abstract class JobStore {
|
|
|
44
49
|
*/
|
|
45
50
|
abstract cancel(id: string, at: Date): Promise<boolean>;
|
|
46
51
|
abstract find(id: string): Promise<QueuedJob | undefined>;
|
|
47
|
-
/** Puts dead jobs back with a fresh attempt budget. Answers how many. */
|
|
52
|
+
/** Puts dead jobs back with a fresh attempt budget, and no lease of before. Answers how many. */
|
|
48
53
|
abstract retryDead(ids: readonly string[], now: Date): Promise<number>;
|
|
49
54
|
/** Housekeeping: drops the jobs that succeeded or were cancelled before `before`. Dead jobs stay. */
|
|
50
55
|
abstract purgeFinished(before: Date): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-store.d.ts","sourceRoot":"","sources":["../../../src/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AAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACvD"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Where background jobs wait between `enqueue` and their run, and what a worker reports of them.
|
|
3
3
|
*
|
|
4
4
|
* A claim is a lease: a job claimed and not heard of before its lease ends is claimed again,
|
|
5
|
-
* which is how the jobs of a worker that died come back. Every report names the
|
|
6
|
-
*
|
|
7
|
-
* the worker stops. Every write answers false
|
|
5
|
+
* which is how the jobs of a worker that died come back. Every report names the lease its claim
|
|
6
|
+
* was handed (`JobLease`), which no other claim of the job ever holds: once the job was claimed
|
|
7
|
+
* again, or cancelled, the store answers false and the worker stops. Every write answers false
|
|
8
|
+
* when it changed nothing.
|
|
8
9
|
*/
|
|
9
10
|
export class JobStore {
|
|
10
11
|
static tokenKey = 'scheduling.JobStore';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-store.js","sourceRoot":"","sources":["../../../src/queue/store/job-store.ts"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"job-store.js","sourceRoot":"","sources":["../../../src/queue/store/job-store.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,MAAM,OAAgB,QAAQ;IAC5B,MAAM,CAAU,QAAQ,GAAG,qBAAqB,CAAC;CA0DlD"}
|
|
@@ -12,6 +12,8 @@ export interface StoredJob {
|
|
|
12
12
|
readonly sequence: number;
|
|
13
13
|
status: QueuedJobStatus;
|
|
14
14
|
attempts: number;
|
|
15
|
+
/** How many times it was claimed: the lease of the claim that holds it. Never moves back. */
|
|
16
|
+
claims: number;
|
|
15
17
|
runAt: Date;
|
|
16
18
|
leaseUntil: Date | undefined;
|
|
17
19
|
progress: JobProgress | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stored-job.d.ts","sourceRoot":"","sources":["../../../src/queue/store/stored-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEnF,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;CAC9B"}
|
|
1
|
+
{"version":3,"file":"stored-job.d.ts","sourceRoot":"","sources":["../../../src/queue/store/stored-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEnF,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,CAAC;IACZ,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;CAC9B"}
|
package/dist/registered-job.d.ts
CHANGED
|
@@ -1,21 +1,76 @@
|
|
|
1
|
-
import { type JobDefinition, type JobPolicy, type JobRun, type
|
|
2
|
-
|
|
1
|
+
import { type JobDefinition, type JobDescription, type JobPolicy, type JobRun, type Lock, type ParsedJobSchedule } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import type { Occurrence } from './occurrence.js';
|
|
3
|
+
/** What became due when the scheduler woke for a job. */
|
|
4
|
+
export interface Reached {
|
|
5
|
+
/** The latest occurrence due: the job is now past it. */
|
|
6
|
+
readonly due: Date;
|
|
7
|
+
/** The occurrence to run: the latest, when it is on time or owed. */
|
|
8
|
+
readonly run?: Occurrence;
|
|
9
|
+
/** The first occurrence passed over, when one was. */
|
|
10
|
+
readonly missed?: Occurrence;
|
|
11
|
+
}
|
|
12
|
+
/** What the scheduler does with an occurrence, for each answer of the overlap policy. */
|
|
13
|
+
export interface Admission {
|
|
14
|
+
readonly now: () => Promise<JobRun>;
|
|
15
|
+
readonly afterPrevious: () => JobRun | Promise<JobRun>;
|
|
16
|
+
readonly skipped: () => JobRun;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A job as this instance follows it: where it stands in its schedule, its sleep until the next
|
|
20
|
+
* occurrence, the run in progress and the one waiting behind it, the lock of the last occurrence
|
|
21
|
+
* and what became of it. The scheduler, the runner and the recorder say what happens; the job
|
|
22
|
+
* alone keeps what its policy makes of it. Held by the scheduler alone.
|
|
23
|
+
*/
|
|
3
24
|
export declare class RegisteredJob {
|
|
4
25
|
readonly definition: JobDefinition;
|
|
5
26
|
readonly name: string;
|
|
6
27
|
readonly policy: JobPolicy;
|
|
7
28
|
readonly schedule: ParsedJobSchedule;
|
|
8
|
-
readonly scheduleText
|
|
29
|
+
private readonly scheduleText;
|
|
9
30
|
/** The last occurrence handled, or the instant the scheduler started following the job. */
|
|
10
|
-
cursor
|
|
11
|
-
|
|
31
|
+
private cursor;
|
|
32
|
+
private sleeping;
|
|
12
33
|
/** The run in progress, or the one waiting behind it. */
|
|
13
|
-
active
|
|
14
|
-
waiting
|
|
15
|
-
lastRun
|
|
34
|
+
private active;
|
|
35
|
+
private waiting;
|
|
36
|
+
private lastRun;
|
|
16
37
|
/** The lock of the last occurrence run, kept until the next one so that no instance runs it again. */
|
|
17
|
-
held
|
|
18
|
-
|
|
38
|
+
private held;
|
|
39
|
+
private aborting;
|
|
19
40
|
constructor(definition: JobDefinition);
|
|
41
|
+
/** The occurrences after `instant` are the ones due from now on. */
|
|
42
|
+
followFrom(instant: Date): void;
|
|
43
|
+
/** The next occurrence, once the job is followed. */
|
|
44
|
+
nextRunAt(): Date | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Of the occurrences that became due at `now`, the latest is run when it is on time or owed, the
|
|
47
|
+
* others are missed: the job moves past them all. Nothing became due: undefined.
|
|
48
|
+
*/
|
|
49
|
+
reach(now: Date, lateAfterMs: number): Reached | undefined;
|
|
50
|
+
/** The job sleeps until `cancelSleep` is called or its timer fires: one sleep at a time. */
|
|
51
|
+
sleep(cancelSleep: () => void): void;
|
|
52
|
+
/** Cancels the sleep, if any: nothing wakes the job after. */
|
|
53
|
+
stopSleeping(): void;
|
|
54
|
+
/**
|
|
55
|
+
* An occurrence runs now when nothing runs, after the run in progress when the job queues and
|
|
56
|
+
* none waits yet, and is skipped otherwise. The job is running until what it admitted ended.
|
|
57
|
+
*/
|
|
58
|
+
admit({ now, afterPrevious, skipped }: Admission): Promise<JobRun>;
|
|
59
|
+
/**
|
|
60
|
+
* Takes the lock of an occurrence, kept until the next one. The lock of the previous occurrence
|
|
61
|
+
* is let go first, at best: one that cannot be released ends at its time to live.
|
|
62
|
+
*/
|
|
63
|
+
hold(lock: Lock, key: string, ttlMs: number): Promise<boolean>;
|
|
64
|
+
/** Until the answered function says the run ended, `abort()` aborts it through `controller`. */
|
|
65
|
+
abortsThrough(controller: AbortController): () => void;
|
|
66
|
+
/** Aborts the run in progress, if any: the scheduler stops and waits no longer. */
|
|
67
|
+
abort(): void;
|
|
68
|
+
/** What became of the last occurrence, whatever it was. */
|
|
69
|
+
handled(run: JobRun): void;
|
|
70
|
+
/** Resolves once the run in progress ended, and the one waiting behind it. */
|
|
71
|
+
settled(): Promise<void>;
|
|
72
|
+
/** `followed`: whether the scheduler follows the job now, which alone gives it a next run. */
|
|
73
|
+
describe(followed: boolean): JobDescription;
|
|
74
|
+
private occupy;
|
|
20
75
|
}
|
|
21
76
|
//# sourceMappingURL=registered-job.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-job.d.ts","sourceRoot":"","sources":["../src/registered-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,
|
|
1
|
+
{"version":3,"file":"registered-job.d.ts","sourceRoot":"","sources":["../src/registered-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EA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AAC,OAAO,EAAE,IAAI,GAAG,IAAI,CAE9B;IAED,qDAAqD;IACrD,SAAS,IAAI,IAAI,GAAG,SAAS,CAE5B;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAoBzD;IAED,4FAA4F;IAC5F,KAAK,CAAC,WAAW,EAAE,MAAM,IAAI,GAAG,IAAI,CAGnC;IAED,8DAA8D;IAC9D,YAAY,IAAI,IAAI,CAGnB;IAED;;;OAGG;IACH,KAAK,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBjE;IAED;;;OAGG;IACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQnE;IAED,gGAAgG;IAChG,aAAa,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,IAAI,CAQrD;IAED,mFAAmF;IACnF,KAAK,IAAI,IAAI,CAEZ;IAED,2DAA2D;IAC3D,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzB;IAED,8EAA8E;IACxE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAE7B;IAED,8FAA8F;IAC9F,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,cAAc,CAW1C;IAED,OAAO,CAAC,MAAM;CAWf"}
|
package/dist/registered-job.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { describeJobSchedule, jobPolicy, parseJobSchedule, } from '@ddd-ts-kit/kernel';
|
|
2
|
-
|
|
2
|
+
import { JobAbortedError } from './errors/job-aborted-error.js';
|
|
3
|
+
import { latestOccurrence } from './occurrences/latest-occurrence.js';
|
|
4
|
+
import { nextOccurrence } from './occurrences/next-occurrence.js';
|
|
5
|
+
/**
|
|
6
|
+
* A job as this instance follows it: where it stands in its schedule, its sleep until the next
|
|
7
|
+
* occurrence, the run in progress and the one waiting behind it, the lock of the last occurrence
|
|
8
|
+
* and what became of it. The scheduler, the runner and the recorder say what happens; the job
|
|
9
|
+
* alone keeps what its policy makes of it. Held by the scheduler alone.
|
|
10
|
+
*/
|
|
3
11
|
export class RegisteredJob {
|
|
4
12
|
definition;
|
|
5
13
|
name;
|
|
@@ -8,14 +16,14 @@ export class RegisteredJob {
|
|
|
8
16
|
scheduleText;
|
|
9
17
|
/** The last occurrence handled, or the instant the scheduler started following the job. */
|
|
10
18
|
cursor;
|
|
11
|
-
|
|
19
|
+
sleeping;
|
|
12
20
|
/** The run in progress, or the one waiting behind it. */
|
|
13
21
|
active;
|
|
14
22
|
waiting = false;
|
|
15
23
|
lastRun;
|
|
16
24
|
/** The lock of the last occurrence run, kept until the next one so that no instance runs it again. */
|
|
17
25
|
held;
|
|
18
|
-
|
|
26
|
+
aborting;
|
|
19
27
|
constructor(definition) {
|
|
20
28
|
this.definition = definition;
|
|
21
29
|
this.name = definition.name;
|
|
@@ -23,5 +31,115 @@ export class RegisteredJob {
|
|
|
23
31
|
this.schedule = parseJobSchedule(definition.schedule);
|
|
24
32
|
this.scheduleText = describeJobSchedule(definition.schedule);
|
|
25
33
|
}
|
|
34
|
+
/** The occurrences after `instant` are the ones due from now on. */
|
|
35
|
+
followFrom(instant) {
|
|
36
|
+
this.cursor = instant;
|
|
37
|
+
}
|
|
38
|
+
/** The next occurrence, once the job is followed. */
|
|
39
|
+
nextRunAt() {
|
|
40
|
+
return this.cursor === undefined ? undefined : nextOccurrence(this.schedule, this.cursor);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Of the occurrences that became due at `now`, the latest is run when it is on time or owed, the
|
|
44
|
+
* others are missed: the job moves past them all. Nothing became due: undefined.
|
|
45
|
+
*/
|
|
46
|
+
reach(now, lateAfterMs) {
|
|
47
|
+
const after = this.cursor ?? now;
|
|
48
|
+
const due = latestOccurrence(this.schedule, { after, notAfter: now });
|
|
49
|
+
if (due === undefined) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
this.cursor = due;
|
|
53
|
+
const earliest = nextOccurrence(this.schedule, after);
|
|
54
|
+
const late = now.getTime() - due.getTime() > lateAfterMs + this.policy.jitterMs;
|
|
55
|
+
const runs = !late || this.policy.missed === 'run-once';
|
|
56
|
+
const passedOver = !runs || earliest.getTime() < due.getTime();
|
|
57
|
+
return {
|
|
58
|
+
due,
|
|
59
|
+
...(runs ? { run: { scheduledAt: due, manual: false } } : {}),
|
|
60
|
+
...(passedOver ? { missed: { scheduledAt: earliest, manual: false } } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** The job sleeps until `cancelSleep` is called or its timer fires: one sleep at a time. */
|
|
64
|
+
sleep(cancelSleep) {
|
|
65
|
+
this.stopSleeping();
|
|
66
|
+
this.sleeping = cancelSleep;
|
|
67
|
+
}
|
|
68
|
+
/** Cancels the sleep, if any: nothing wakes the job after. */
|
|
69
|
+
stopSleeping() {
|
|
70
|
+
this.sleeping?.();
|
|
71
|
+
this.sleeping = undefined;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An occurrence runs now when nothing runs, after the run in progress when the job queues and
|
|
75
|
+
* none waits yet, and is skipped otherwise. The job is running until what it admitted ended.
|
|
76
|
+
*/
|
|
77
|
+
admit({ now, afterPrevious, skipped }) {
|
|
78
|
+
const previous = this.active;
|
|
79
|
+
if (previous === undefined) {
|
|
80
|
+
return this.occupy(now());
|
|
81
|
+
}
|
|
82
|
+
if (this.policy.overlap === 'skip' || this.waiting) {
|
|
83
|
+
return Promise.resolve(skipped());
|
|
84
|
+
}
|
|
85
|
+
this.waiting = true;
|
|
86
|
+
return this.occupy(previous.then(() => {
|
|
87
|
+
this.waiting = false;
|
|
88
|
+
return afterPrevious();
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Takes the lock of an occurrence, kept until the next one. The lock of the previous occurrence
|
|
93
|
+
* is let go first, at best: one that cannot be released ends at its time to live.
|
|
94
|
+
*/
|
|
95
|
+
async hold(lock, key, ttlMs) {
|
|
96
|
+
const previous = this.held;
|
|
97
|
+
this.held = undefined;
|
|
98
|
+
await previous?.release().catch(() => undefined);
|
|
99
|
+
this.held = await lock.acquire(key, { ttlMs });
|
|
100
|
+
return this.held !== undefined;
|
|
101
|
+
}
|
|
102
|
+
/** Until the answered function says the run ended, `abort()` aborts it through `controller`. */
|
|
103
|
+
abortsThrough(controller) {
|
|
104
|
+
this.aborting = (reason) => {
|
|
105
|
+
controller.abort(reason);
|
|
106
|
+
};
|
|
107
|
+
return () => {
|
|
108
|
+
this.aborting = undefined;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** Aborts the run in progress, if any: the scheduler stops and waits no longer. */
|
|
112
|
+
abort() {
|
|
113
|
+
this.aborting?.(new JobAbortedError(this.name));
|
|
114
|
+
}
|
|
115
|
+
/** What became of the last occurrence, whatever it was. */
|
|
116
|
+
handled(run) {
|
|
117
|
+
this.lastRun = run;
|
|
118
|
+
}
|
|
119
|
+
/** Resolves once the run in progress ended, and the one waiting behind it. */
|
|
120
|
+
async settled() {
|
|
121
|
+
await this.active;
|
|
122
|
+
}
|
|
123
|
+
/** `followed`: whether the scheduler follows the job now, which alone gives it a next run. */
|
|
124
|
+
describe(followed) {
|
|
125
|
+
const nextRunAt = followed ? this.nextRunAt() : undefined;
|
|
126
|
+
return {
|
|
127
|
+
name: this.name,
|
|
128
|
+
schedule: this.scheduleText,
|
|
129
|
+
enabled: this.policy.enabled,
|
|
130
|
+
running: this.active !== undefined,
|
|
131
|
+
...(nextRunAt === undefined ? {} : { nextRunAt }),
|
|
132
|
+
...(this.lastRun === undefined ? {} : { lastRun: this.lastRun }),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
occupy(run) {
|
|
136
|
+
const active = run.finally(() => {
|
|
137
|
+
if (this.active === active) {
|
|
138
|
+
this.active = undefined;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
this.active = active;
|
|
142
|
+
return active;
|
|
143
|
+
}
|
|
26
144
|
}
|
|
27
145
|
//# sourceMappingURL=registered-job.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-job.js","sourceRoot":"","sources":["../src/registered-job.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,gBAAgB,
|
|
1
|
+
{"version":3,"file":"registered-job.js","sourceRoot":"","sources":["../src/registered-job.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,gBAAgB,GAQjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAmB/D;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IA0BH,UAAU;IAzBtB,IAAI,CAAS;IAEb,MAAM,CAAY;IAElB,QAAQ,CAAoB;IAEpB,YAAY,CAAS;IAEtC,2FAA2F;IACnF,MAAM,CAAmB;IAEzB,QAAQ,CAA2B;IAE3C,yDAAyD;IACjD,MAAM,CAA8B;IAEpC,OAAO,GAAG,KAAK,CAAC;IAEhB,OAAO,CAAqB;IAEpC,sGAAsG;IAC9F,IAAI,CAAyB;IAE7B,QAAQ,CAAwC;IAExD,YAAqB,UAAyB;0BAAzB,UAAU;QAC7B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,GAAG,mBAAmB,CAAC,UAAU,CAAC,QAA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C,EAAE,SAAS,EAAE,CAAC;YACjD,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;SACjE,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,GAAoB;QACjC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-ts-kit/scheduling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.115.0",
|
|
4
4
|
"description": "Scheduled jobs that only trigger use cases: interval and cron schedules, one run across instances, no overlap, each run in its own execution scope.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/
|
|
19
|
+
"url": "git+https://github.com/ddd-ts-kit/ddd-ts-kit.git",
|
|
20
20
|
"directory": "packages/scheduling"
|
|
21
21
|
},
|
|
22
|
-
"homepage": "https://
|
|
23
|
-
"bugs": "https://github.com/
|
|
22
|
+
"homepage": "https://ddd-ts-kit.github.io/ddd-ts-kit/packages/scheduling/",
|
|
23
|
+
"bugs": "https://github.com/ddd-ts-kit/ddd-ts-kit/issues",
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public",
|
|
26
26
|
"provenance": true
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dist"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ddd-ts-kit/kernel": "0.
|
|
47
|
+
"@ddd-ts-kit/kernel": "0.115.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@ddd-ts-kit/testing": "0.
|
|
50
|
+
"@ddd-ts-kit/testing": "0.115.0"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BackgroundJobRun } from './background-job-run.js';
|
|
2
|
-
/** What a worker follows of one queue. */
|
|
3
|
-
export interface QueueState {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly concurrency: number;
|
|
6
|
-
/** The attempts in progress. */
|
|
7
|
-
readonly active: Set<Promise<BackgroundJobRun>>;
|
|
8
|
-
/** The claim in progress and the launch of what it claimed, which `stop` waits for. */
|
|
9
|
-
filling: Promise<void> | undefined;
|
|
10
|
-
cancelSleep: (() => void) | undefined;
|
|
11
|
-
/** When its depth was last set as gauges, in milliseconds since the epoch. */
|
|
12
|
-
measuredAt: number;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=queue-state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue-state.d.ts","sourceRoot":"","sources":["../../src/queue/queue-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gCAAgC;IAChC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAChD,uFAAuF;IACvF,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACtC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queue-state.js","sourceRoot":"","sources":["../../src/queue/queue-state.ts"],"names":[],"mappings":""}
|