@squiz/job-runner-lib 2.8.0 → 2.9.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 +6 -0
- package/lib/domains/job/constants/QueueBacklog.constants.d.ts +11 -0
- package/lib/domains/job/index.d.ts +1 -0
- package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.d.ts +15 -0
- package/lib/index.js +9 -9
- package/lib/index.js.map +4 -4
- package/package.json +1 -1
- package/src/domains/job/constants/QueueBacklog.constants.ts +12 -0
- package/src/domains/job/constants/RuntimeImage.constants.ts +1 -1
- package/src/domains/job/index.ts +1 -0
- package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.ts +65 -0
- package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.ts +53 -0
- package/src/domains/manifest/utils/validateRuntimeImage.spec.ts +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Squiz Australia Pty Ltd. All Rights Reserved.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Backlog guard defaults. A job's `begin` is rejected with 422 once it has more than
|
|
7
|
+
* DEFAULT_MAX_QUEUED_EXECUTIONS queued AND its oldest queued execution is older than
|
|
8
|
+
* DEFAULT_MAX_QUEUED_AGE_HOURS. Both conditions are required (large AND stale).
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_MAX_QUEUED_EXECUTIONS = 500;
|
|
11
|
+
export declare const DEFAULT_MAX_QUEUED_AGE_HOURS = 2;
|
|
@@ -2,6 +2,7 @@ export * from './core/dynamoClient.mock';
|
|
|
2
2
|
export * from './core/pagination';
|
|
3
3
|
export * from './constants/InjectTokens';
|
|
4
4
|
export * from './constants/JobExecutionStatus.constants';
|
|
5
|
+
export * from './constants/QueueBacklog.constants';
|
|
5
6
|
export * from './constants/Repository.constants';
|
|
6
7
|
export * from './constants/RetryConfig.constants';
|
|
7
8
|
export * from './constants/RuntimeImage.constants';
|
|
@@ -16,6 +16,21 @@ export declare class JobExecutionRepository extends Repository<JobExecution, Job
|
|
|
16
16
|
* @memberof JobExecutionRepository
|
|
17
17
|
*/
|
|
18
18
|
list(parameters?: ListJobExecutionParameters): Promise<Array<JobExecution>>;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the single oldest queued execution for a job, or null if there are none.
|
|
21
|
+
*
|
|
22
|
+
* Queries the `lsi1` index (`lsi1sk = "<status>~<jobName>"`). All queued executions of one
|
|
23
|
+
* job share the same `lsi1sk`, so DynamoDB breaks ties by the base-table `sk`
|
|
24
|
+
* (`"<jobName>~<id>"`); `id` is prefixed with the ISO `timeQueued`, which sorts
|
|
25
|
+
* lexicographically, so ascending order is chronological and the first item is the oldest.
|
|
26
|
+
*/
|
|
27
|
+
getOldestQueuedExecution(jobName: string): Promise<JobExecution | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Counts queued executions for a job, evaluating at most `limit` items (`Select: COUNT` so no
|
|
30
|
+
* item data is returned). Pass a `limit` just above the threshold you care about — queued
|
|
31
|
+
* items are small, so a single page covers the bounded count.
|
|
32
|
+
*/
|
|
33
|
+
countQueuedExecutions(jobName: string, limit?: number): Promise<number>;
|
|
19
34
|
/**
|
|
20
35
|
* Get list of records from database.
|
|
21
36
|
* @abstract
|