velocious 1.0.742 → 1.0.744
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/build/background-jobs/client.js +24 -7
- package/build/background-jobs/enqueue-acknowledgement-timeout-error.js +13 -1
- package/build/background-jobs/job.js +5 -3
- package/build/background-jobs/runtime.js +6 -3
- package/build/background-jobs/types.js +1 -1
- package/build/src/background-jobs/client.d.ts +11 -1
- package/build/src/background-jobs/client.d.ts.map +1 -1
- package/build/src/background-jobs/client.js +23 -8
- package/build/src/background-jobs/enqueue-acknowledgement-timeout-error.d.ts +11 -1
- package/build/src/background-jobs/enqueue-acknowledgement-timeout-error.d.ts.map +1 -1
- package/build/src/background-jobs/enqueue-acknowledgement-timeout-error.js +13 -2
- package/build/src/background-jobs/job.d.ts +4 -2
- package/build/src/background-jobs/job.d.ts.map +1 -1
- package/build/src/background-jobs/job.js +6 -4
- package/build/src/background-jobs/runtime.d.ts +3 -1
- package/build/src/background-jobs/runtime.d.ts.map +1 -1
- package/build/src/background-jobs/runtime.js +7 -4
- package/build/src/background-jobs/types.d.ts +4 -2
- package/build/src/background-jobs/types.d.ts.map +1 -1
- package/build/src/background-jobs/types.js +2 -2
- package/package.json +1 -1
- package/src/background-jobs/client.js +24 -7
- package/src/background-jobs/enqueue-acknowledgement-timeout-error.js +13 -1
- package/src/background-jobs/job.js +5 -3
- package/src/background-jobs/runtime.js +6 -3
- package/src/background-jobs/types.js +1 -1
|
@@ -25,8 +25,9 @@ export default class BackgroundJobEnqueueAcknowledgementTimeoutError extends Tim
|
|
|
25
25
|
* @param {string} args.jobName - Resolved job class name.
|
|
26
26
|
* @param {string} [args.producerInvocationId] - Owned enqueue invocation identity.
|
|
27
27
|
* @param {boolean} args.producerProofPresent - Whether the request carried an internal producer proof.
|
|
28
|
+
* @param {string} [args.queue] - Resolved queue the enqueue was addressed to.
|
|
28
29
|
*/
|
|
29
|
-
constructor({acknowledgementTimeoutMs, attemptHistory, cause, generationId, jobName, producerInvocationId, producerProofPresent}) {
|
|
30
|
+
constructor({acknowledgementTimeoutMs, attemptHistory, cause, generationId, jobName, producerInvocationId, producerProofPresent, queue}) {
|
|
30
31
|
super(`Background job enqueue acknowledgement timed out after ${acknowledgementTimeoutMs}ms`, cause ? {cause} : undefined)
|
|
31
32
|
|
|
32
33
|
this.name = "BackgroundJobEnqueueAcknowledgementTimeoutError"
|
|
@@ -46,5 +47,16 @@ export default class BackgroundJobEnqueueAcknowledgementTimeoutError extends Tim
|
|
|
46
47
|
this.jobName = jobName
|
|
47
48
|
this.producerInvocationId = producerInvocationId
|
|
48
49
|
this.producerProofPresent = producerProofPresent
|
|
50
|
+
this.queue = queue
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Total wall time the client spent waiting for an acknowledgement across every
|
|
55
|
+
* attempt it made, so a caller can compare the wait against its own budget
|
|
56
|
+
* without walking the attempt history.
|
|
57
|
+
* @returns {number} - Elapsed milliseconds of the longest timed-out attempt.
|
|
58
|
+
*/
|
|
59
|
+
elapsedMs() {
|
|
60
|
+
return this.attemptHistory.reduce((longest, attempt) => Math.max(longest, attempt.attemptElapsedMs), 0)
|
|
49
61
|
}
|
|
50
62
|
}
|
|
@@ -43,12 +43,13 @@ export default class VelociousJob extends PlatformVelociousJob {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* Runs perform later with options.
|
|
46
|
-
* @param {object} args -
|
|
46
|
+
* @param {object} args - Job options.
|
|
47
47
|
* @param {Array<ReturnType<typeof JSON.parse>>} args.args - Job args.
|
|
48
48
|
* @param {import("./types.js").BackgroundJobOptions} [args.options] - Job options.
|
|
49
|
+
* @param {number} [args.enqueueTimeoutMs] - Per-enqueue acknowledgement deadline for this enqueue only; overrides the client default.
|
|
49
50
|
* @returns {Promise<string>} - Job id.
|
|
50
51
|
*/
|
|
51
|
-
static async performLaterWithOptions({args, options}) {
|
|
52
|
+
static async performLaterWithOptions({args, options, enqueueTimeoutMs}) {
|
|
52
53
|
const configuration = await configurationResolver()
|
|
53
54
|
const producerProof = currentBackgroundJobProducerProof()
|
|
54
55
|
|
|
@@ -58,7 +59,8 @@ export default class VelociousJob extends PlatformVelociousJob {
|
|
|
58
59
|
jobArgs: args,
|
|
59
60
|
jobOptions: options,
|
|
60
61
|
producerProof,
|
|
61
|
-
producerInvocationId: producerProof ? randomUUID() : undefined
|
|
62
|
+
producerInvocationId: producerProof ? randomUUID() : undefined,
|
|
63
|
+
enqueueTimeoutMs
|
|
62
64
|
})
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -51,9 +51,10 @@ export async function enqueueBackgroundJob({JobClass, jobArgs, jobOptions}) {
|
|
|
51
51
|
* @param {import("./types.js").BackgroundJobOptions | undefined} args.jobOptions - Job options.
|
|
52
52
|
* @param {string} [args.producerInvocationId] - Stable identity for one owned enqueue invocation.
|
|
53
53
|
* @param {import("./types.js").BackgroundJobProducerProof} [args.producerProof] - Exact internal producer handoff.
|
|
54
|
+
* @param {number} [args.enqueueTimeoutMs] - Per-enqueue acknowledgement deadline for the transport wait.
|
|
54
55
|
* @returns {Promise<string>} - Durable job id or ephemeral inline performance id.
|
|
55
56
|
*/
|
|
56
|
-
export async function enqueueBackgroundJobForConfiguration({configuration, JobClass, jobArgs, jobOptions, producerInvocationId, producerProof}) {
|
|
57
|
+
export async function enqueueBackgroundJobForConfiguration({configuration, JobClass, jobArgs, jobOptions, producerInvocationId, producerProof, enqueueTimeoutMs}) {
|
|
57
58
|
const resolvedJobOptions = JobClass._withJobContext({jobArgs, jobOptions})
|
|
58
59
|
|
|
59
60
|
if (configuration.getBackgroundJobsConfig().mode === "inline") {
|
|
@@ -83,11 +84,13 @@ export async function enqueueBackgroundJobForConfiguration({configuration, JobCl
|
|
|
83
84
|
const client = configuration.getEnvironmentHandler().backgroundJobsClient({configuration})
|
|
84
85
|
|
|
85
86
|
return await client.enqueue({
|
|
86
|
-
jobName: JobClass.jobName(),
|
|
87
87
|
args: jobArgs,
|
|
88
|
+
enqueueTimeoutMs,
|
|
89
|
+
jobName: JobClass.jobName(),
|
|
88
90
|
options: resolvedJobOptions,
|
|
89
91
|
producerInvocationId,
|
|
90
|
-
producerProof
|
|
92
|
+
producerProof,
|
|
93
|
+
queue: resolvedJobOptions.queue
|
|
91
94
|
})
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
*/
|
|
151
151
|
/**
|
|
152
152
|
* @typedef {object} BackgroundJobsProducer
|
|
153
|
-
* @property {(args: {jobName: string, args: Array<ReturnType<typeof JSON.parse>>, options?: BackgroundJobOptions, producerInvocationId?: string, producerProof?: BackgroundJobProducerProof}) => Promise<string>} enqueue - Enqueues a job.
|
|
153
|
+
* @property {(args: {jobName: string, args: Array<ReturnType<typeof JSON.parse>>, enqueueTimeoutMs?: number, options?: BackgroundJobOptions, producerInvocationId?: string, producerProof?: BackgroundJobProducerProof, queue?: string}) => Promise<string>} enqueue - Enqueues a job. A producer that waits for an acknowledgement applies `enqueueTimeoutMs` to that wait for this enqueue only, and reports `queue` on the failure it raises.
|
|
154
154
|
* @property {(args: {scheduleKey: string, jobName: string, args: Array<ReturnType<typeof JSON.parse>>, options?: BackgroundJobOptions}) => Promise<BackgroundJobReplacementResult>} replaceScheduled - Replaces a stable schedule.
|
|
155
155
|
* @property {(args: {scheduleKey: string}) => Promise<BackgroundJobCancellationResult>} cancelScheduled - Cancels a stable schedule.
|
|
156
156
|
* @property {(args: {scheduleKey: string, includeLatestTerminal?: boolean}) => Promise<BackgroundJobScheduledLookupResult>} getScheduledJob - Reads stable schedule ownership and history.
|