@convex-dev/workpool 0.2.18-alpha.3 → 0.2.19-alpha.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.md +83 -76
- package/dist/commonjs/client/index.d.ts +98 -31
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +124 -49
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/component/kick.d.ts.map +1 -1
- package/dist/commonjs/component/kick.js +2 -2
- package/dist/commonjs/component/kick.js.map +1 -1
- package/dist/commonjs/component/lib.d.ts +39 -1
- package/dist/commonjs/component/lib.d.ts.map +1 -1
- package/dist/commonjs/component/lib.js +92 -56
- package/dist/commonjs/component/lib.js.map +1 -1
- package/dist/esm/client/index.d.ts +98 -31
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +124 -49
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/component/kick.d.ts.map +1 -1
- package/dist/esm/component/kick.js +2 -2
- package/dist/esm/component/kick.js.map +1 -1
- package/dist/esm/component/lib.d.ts +39 -1
- package/dist/esm/component/lib.d.ts.map +1 -1
- package/dist/esm/component/lib.js +92 -56
- package/dist/esm/component/lib.js.map +1 -1
- package/package.json +15 -10
- package/src/client/index.ts +225 -82
- package/src/component/_generated/api.d.ts +34 -0
- package/src/component/kick.ts +3 -1
- package/src/component/lib.ts +108 -61
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultFunctionArgs, FunctionReference, FunctionVisibility, GenericDataModel, GenericMutationCtx, RegisteredMutation } from "convex/server";
|
|
1
|
+
import { DefaultFunctionArgs, FunctionReference, FunctionType, FunctionVisibility, GenericDataModel, GenericMutationCtx, RegisteredMutation } from "convex/server";
|
|
2
2
|
import { Infer, Validator, VAny, VString } from "convex/values";
|
|
3
3
|
import { Mounts } from "../component/_generated/api.js";
|
|
4
4
|
import { type LogLevel } from "../component/logging.js";
|
|
@@ -61,8 +61,9 @@ export declare const vOnComplete: import("convex/values").VObject<{
|
|
|
61
61
|
/** @deprecated Use `vOnCompleteArgs()` instead. */
|
|
62
62
|
export declare const vOnCompleteValidator: typeof vOnCompleteArgs;
|
|
63
63
|
export declare const DEFAULT_RETRY_BEHAVIOR: RetryBehavior;
|
|
64
|
+
export type WorkpoolComponent = UseApi<Mounts>;
|
|
64
65
|
export declare class Workpool {
|
|
65
|
-
|
|
66
|
+
component: WorkpoolComponent;
|
|
66
67
|
options: WorkpoolOptions;
|
|
67
68
|
/**
|
|
68
69
|
* Initializes a Workpool.
|
|
@@ -75,8 +76,7 @@ export declare class Workpool {
|
|
|
75
76
|
* `./_generated/api.ts`.
|
|
76
77
|
* @param options - The {@link WorkpoolOptions} for the Workpool.
|
|
77
78
|
*/
|
|
78
|
-
constructor(component:
|
|
79
|
-
options: WorkpoolOptions);
|
|
79
|
+
constructor(component: WorkpoolComponent, options: WorkpoolOptions);
|
|
80
80
|
/**
|
|
81
81
|
* Enqueues an action to be run.
|
|
82
82
|
*
|
|
@@ -87,7 +87,20 @@ export declare class Workpool {
|
|
|
87
87
|
* onComplete handling, and scheduling via `runAt` or `runAfter`.
|
|
88
88
|
* @returns The ID of the work that was enqueued.
|
|
89
89
|
*/
|
|
90
|
-
enqueueAction<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"action", FunctionVisibility, Args, ReturnType>, fnArgs: Args, options?: RetryOption &
|
|
90
|
+
enqueueAction<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"action", FunctionVisibility, Args, ReturnType>, fnArgs: Args, options?: RetryOption & EnqueueOptions): Promise<WorkId>;
|
|
91
|
+
/**
|
|
92
|
+
* Enqueues a batch of actions to be run.
|
|
93
|
+
* Each action will be run independently, and the onComplete handler will
|
|
94
|
+
* be called for each action.
|
|
95
|
+
*
|
|
96
|
+
* @param ctx - The mutation or action ctx that can call ctx.runMutation.
|
|
97
|
+
* @param fn - The action to run, like `internal.example.myAction`.
|
|
98
|
+
* @param argsArray - The arguments to pass to the action.
|
|
99
|
+
* @param options - The options for the actions to specify retry behavior,
|
|
100
|
+
* onComplete handling, and scheduling via `runAt` or `runAfter`.
|
|
101
|
+
* @returns The IDs of the work that was enqueued.
|
|
102
|
+
*/
|
|
103
|
+
enqueueActionBatch<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"action", FunctionVisibility, Args, ReturnType>, argsArray: Array<Args>, options?: RetryOption & EnqueueOptions): Promise<WorkId[]>;
|
|
91
104
|
/**
|
|
92
105
|
* Enqueues a mutation to be run.
|
|
93
106
|
*
|
|
@@ -101,8 +114,44 @@ export declare class Workpool {
|
|
|
101
114
|
* @param options - The options for the mutation to specify onComplete handling
|
|
102
115
|
* and scheduling via `runAt` or `runAfter`.
|
|
103
116
|
*/
|
|
104
|
-
enqueueMutation<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"mutation", FunctionVisibility, Args, ReturnType>, fnArgs: Args, options?:
|
|
105
|
-
|
|
117
|
+
enqueueMutation<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"mutation", FunctionVisibility, Args, ReturnType>, fnArgs: Args, options?: EnqueueOptions): Promise<WorkId>;
|
|
118
|
+
/**
|
|
119
|
+
* Enqueues a batch of mutations to be run.
|
|
120
|
+
* Each mutation will be run independently, and the onComplete handler will
|
|
121
|
+
* be called for each mutation.
|
|
122
|
+
*
|
|
123
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
124
|
+
* @param fn - The mutation to run, like `internal.example.myMutation`.
|
|
125
|
+
* @param argsArray - The arguments to pass to the mutations.
|
|
126
|
+
* @param options - The options for the mutations to specify onComplete handling
|
|
127
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
128
|
+
*/
|
|
129
|
+
enqueueMutationBatch<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"mutation", FunctionVisibility, Args, ReturnType>, argsArray: Array<Args>, options?: EnqueueOptions): Promise<WorkId[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Enqueues a query to be run.
|
|
132
|
+
* Usually not what you want, but it can be useful during workflows.
|
|
133
|
+
* The query is run in a mutation and the result is returned to the caller,
|
|
134
|
+
* so it can conflict if other mutations are writing the value.
|
|
135
|
+
*
|
|
136
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
137
|
+
* @param fn - The query to run, like `internal.example.myQuery`.
|
|
138
|
+
* @param fnArgs - The arguments to pass to the query.
|
|
139
|
+
* @param options - The options for the query to specify onComplete handling
|
|
140
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
141
|
+
*/
|
|
142
|
+
enqueueQuery<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"query", FunctionVisibility, Args, ReturnType>, fnArgs: Args, options?: EnqueueOptions): Promise<WorkId>;
|
|
143
|
+
/**
|
|
144
|
+
* Enqueues a batch of queries to be run.
|
|
145
|
+
* Each query will be run independently, and the onComplete handler will
|
|
146
|
+
* be called for each query.
|
|
147
|
+
*
|
|
148
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
149
|
+
* @param fn - The query to run, like `internal.example.myQuery`.
|
|
150
|
+
* @param argsArray - The arguments to pass to the queries.
|
|
151
|
+
* @param options - The options for the queries to specify onComplete handling
|
|
152
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
153
|
+
*/
|
|
154
|
+
enqueueQueryBatch<Args extends DefaultFunctionArgs, ReturnType>(ctx: RunMutationCtx, fn: FunctionReference<"query", FunctionVisibility, Args, ReturnType>, argsArray: Array<Args>, options?: EnqueueOptions): Promise<WorkId[]>;
|
|
106
155
|
/**
|
|
107
156
|
* Cancels a work item. If it's already started, it will be allowed to finish
|
|
108
157
|
* but will not be retried.
|
|
@@ -116,7 +165,9 @@ export declare class Workpool {
|
|
|
116
165
|
*
|
|
117
166
|
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
118
167
|
*/
|
|
119
|
-
cancelAll(ctx: RunMutationCtx
|
|
168
|
+
cancelAll(ctx: RunMutationCtx, options?: {
|
|
169
|
+
limit?: number;
|
|
170
|
+
}): Promise<void>;
|
|
120
171
|
/**
|
|
121
172
|
* Gets the status of a work item.
|
|
122
173
|
*
|
|
@@ -128,6 +179,14 @@ export declare class Workpool {
|
|
|
128
179
|
* - `{ state: "finished" }`
|
|
129
180
|
*/
|
|
130
181
|
status(ctx: RunQueryCtx, id: WorkId): Promise<Status>;
|
|
182
|
+
/**
|
|
183
|
+
* Gets the status of a batch of work items.
|
|
184
|
+
*
|
|
185
|
+
* @param ctx - The query context that can call ctx.runQuery.
|
|
186
|
+
* @param ids - The IDs of the work to get the status of.
|
|
187
|
+
* @returns The status of the work items.
|
|
188
|
+
*/
|
|
189
|
+
statusBatch(ctx: RunQueryCtx, ids: WorkId[]): Promise<Status[]>;
|
|
131
190
|
/**
|
|
132
191
|
* Defines a mutation that will be run after a work item completes.
|
|
133
192
|
* You can pass this to a call to enqueue* like so:
|
|
@@ -255,16 +314,9 @@ export declare function vOnCompleteArgs<V extends Validator<any, "required", any
|
|
|
255
314
|
kind: import("convex/values").VLiteral<"canceled", "required">;
|
|
256
315
|
}, "required", "kind">], "required", "kind" | "returnValue" | `returnValue.${string}` | "error">;
|
|
257
316
|
}, "required", "context" | "workId" | "result" | `context.${V["fieldPaths"]}` | "result.kind" | "result.returnValue" | `result.returnValue.${string}` | "result.error">;
|
|
258
|
-
export type NameOption = {
|
|
259
|
-
/**
|
|
260
|
-
* The name of the function. By default, if you pass in api.foo.bar.baz,
|
|
261
|
-
* it will use "foo/bar:baz" as the name. If you pass in a function handle,
|
|
262
|
-
* it will use the function handle directly.
|
|
263
|
-
*/
|
|
264
|
-
name?: string;
|
|
265
|
-
};
|
|
266
317
|
export type RetryOption = {
|
|
267
318
|
/** Whether to retry the action if it fails.
|
|
319
|
+
* If false, the action won’t be retried.
|
|
268
320
|
* If true, it will use the default retry behavior.
|
|
269
321
|
* If custom behavior is provided, it will retry using that behavior.
|
|
270
322
|
* If unset, it will use the Workpool's configured default.
|
|
@@ -298,22 +350,13 @@ export type WorkpoolRetryOptions = {
|
|
|
298
350
|
*/
|
|
299
351
|
retryActionsByDefault?: boolean;
|
|
300
352
|
};
|
|
301
|
-
export type
|
|
302
|
-
/**
|
|
303
|
-
* The time (ms since epoch) to run the action at.
|
|
304
|
-
* If not provided, the action will be run as soon as possible.
|
|
305
|
-
* Note: this is advisory only. It may run later.
|
|
306
|
-
*/
|
|
307
|
-
runAt?: number;
|
|
308
|
-
} | {
|
|
353
|
+
export type EnqueueOptions = {
|
|
309
354
|
/**
|
|
310
|
-
* The
|
|
311
|
-
*
|
|
312
|
-
*
|
|
355
|
+
* The name of the function. By default, if you pass in api.foo.bar.baz,
|
|
356
|
+
* it will use "foo/bar:baz" as the name. If you pass in a function handle,
|
|
357
|
+
* it will use the function handle directly.
|
|
313
358
|
*/
|
|
314
|
-
|
|
315
|
-
};
|
|
316
|
-
export type CallbackOptions = {
|
|
359
|
+
name?: string;
|
|
317
360
|
/**
|
|
318
361
|
* A mutation to run after the function succeeds, fails, or is canceled.
|
|
319
362
|
* The context type is for your use, feel free to provide a validator for it.
|
|
@@ -343,7 +386,21 @@ export type CallbackOptions = {
|
|
|
343
386
|
* Useful for passing data from the enqueue site to the onComplete site.
|
|
344
387
|
*/
|
|
345
388
|
context?: unknown;
|
|
346
|
-
}
|
|
389
|
+
} & ({
|
|
390
|
+
/**
|
|
391
|
+
* The time (ms since epoch) to run the action at.
|
|
392
|
+
* If not provided, the action will be run as soon as possible.
|
|
393
|
+
* Note: this is advisory only. It may run later.
|
|
394
|
+
*/
|
|
395
|
+
runAt?: number;
|
|
396
|
+
} | {
|
|
397
|
+
/**
|
|
398
|
+
* The number of milliseconds to run the action after.
|
|
399
|
+
* If not provided, the action will be run as soon as possible.
|
|
400
|
+
* Note: this is advisory only. It may run later.
|
|
401
|
+
*/
|
|
402
|
+
runAfter?: number;
|
|
403
|
+
});
|
|
347
404
|
export type OnCompleteArgs = {
|
|
348
405
|
/**
|
|
349
406
|
* The ID of the work that completed.
|
|
@@ -359,4 +416,14 @@ export type OnCompleteArgs = {
|
|
|
359
416
|
*/
|
|
360
417
|
result: RunResult;
|
|
361
418
|
};
|
|
419
|
+
export declare function enqueueBatch<FnType extends FunctionType, Args extends DefaultFunctionArgs, ReturnType>(component: UseApi<Mounts>, ctx: RunMutationCtx, fnType: FnType, fn: FunctionReference<FnType, FunctionVisibility, Args, ReturnType>, fnArgsArray: Array<Args>, options: EnqueueOptions & {
|
|
420
|
+
retryBehavior?: RetryBehavior;
|
|
421
|
+
maxParallelism?: number;
|
|
422
|
+
logLevel?: LogLevel;
|
|
423
|
+
}): Promise<WorkId[]>;
|
|
424
|
+
export declare function enqueue<FnType extends FunctionType, Args extends DefaultFunctionArgs, ReturnType>(component: UseApi<Mounts>, ctx: RunMutationCtx, fnType: FnType, fn: FunctionReference<FnType, FunctionVisibility, Args, ReturnType>, fnArgs: Args, options: EnqueueOptions & {
|
|
425
|
+
retryBehavior?: RetryBehavior;
|
|
426
|
+
maxParallelism?: number;
|
|
427
|
+
logLevel?: LogLevel;
|
|
428
|
+
}): Promise<WorkId>;
|
|
362
429
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEnB,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAK,SAAS,EA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CAAC,MAAM,CAAC,CAOjB"}
|
package/dist/esm/client/index.js
CHANGED
|
@@ -36,8 +36,7 @@ export class Workpool {
|
|
|
36
36
|
* `./_generated/api.ts`.
|
|
37
37
|
* @param options - The {@link WorkpoolOptions} for the Workpool.
|
|
38
38
|
*/
|
|
39
|
-
constructor(component,
|
|
40
|
-
options) {
|
|
39
|
+
constructor(component, options) {
|
|
41
40
|
this.component = component;
|
|
42
41
|
this.options = options;
|
|
43
42
|
}
|
|
@@ -53,21 +52,31 @@ export class Workpool {
|
|
|
53
52
|
*/
|
|
54
53
|
async enqueueAction(ctx, fn, fnArgs, options) {
|
|
55
54
|
const retryBehavior = getRetryBehavior(this.options.defaultRetryBehavior, this.options.retryActionsByDefault, options?.retry);
|
|
56
|
-
|
|
57
|
-
? {
|
|
58
|
-
fnHandle: await createFunctionHandle(options.onComplete),
|
|
59
|
-
context: options.context,
|
|
60
|
-
}
|
|
61
|
-
: undefined;
|
|
62
|
-
const id = await ctx.runMutation(this.component.lib.enqueue, {
|
|
63
|
-
...(await defaultEnqueueArgs(fn, options?.name, this.options)),
|
|
64
|
-
fnArgs,
|
|
65
|
-
fnType: "action",
|
|
66
|
-
runAt: getRunAt(options),
|
|
67
|
-
onComplete,
|
|
55
|
+
return enqueue(this.component, ctx, "action", fn, fnArgs, {
|
|
68
56
|
retryBehavior,
|
|
57
|
+
...this.options,
|
|
58
|
+
...options,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Enqueues a batch of actions to be run.
|
|
63
|
+
* Each action will be run independently, and the onComplete handler will
|
|
64
|
+
* be called for each action.
|
|
65
|
+
*
|
|
66
|
+
* @param ctx - The mutation or action ctx that can call ctx.runMutation.
|
|
67
|
+
* @param fn - The action to run, like `internal.example.myAction`.
|
|
68
|
+
* @param argsArray - The arguments to pass to the action.
|
|
69
|
+
* @param options - The options for the actions to specify retry behavior,
|
|
70
|
+
* onComplete handling, and scheduling via `runAt` or `runAfter`.
|
|
71
|
+
* @returns The IDs of the work that was enqueued.
|
|
72
|
+
*/
|
|
73
|
+
async enqueueActionBatch(ctx, fn, argsArray, options) {
|
|
74
|
+
const retryBehavior = getRetryBehavior(this.options.defaultRetryBehavior, this.options.retryActionsByDefault, options?.retry);
|
|
75
|
+
return enqueueBatch(this.component, ctx, "action", fn, argsArray, {
|
|
76
|
+
retryBehavior,
|
|
77
|
+
...this.options,
|
|
78
|
+
...options,
|
|
69
79
|
});
|
|
70
|
-
return id;
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* Enqueues a mutation to be run.
|
|
@@ -83,36 +92,62 @@ export class Workpool {
|
|
|
83
92
|
* and scheduling via `runAt` or `runAfter`.
|
|
84
93
|
*/
|
|
85
94
|
async enqueueMutation(ctx, fn, fnArgs, options) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
context: options.context,
|
|
90
|
-
}
|
|
91
|
-
: undefined;
|
|
92
|
-
const id = await ctx.runMutation(this.component.lib.enqueue, {
|
|
93
|
-
...(await defaultEnqueueArgs(fn, options?.name, this.options)),
|
|
94
|
-
fnArgs,
|
|
95
|
-
fnType: "mutation",
|
|
96
|
-
runAt: getRunAt(options),
|
|
97
|
-
onComplete,
|
|
95
|
+
return enqueue(this.component, ctx, "mutation", fn, fnArgs, {
|
|
96
|
+
...this.options,
|
|
97
|
+
...options,
|
|
98
98
|
});
|
|
99
|
-
return id;
|
|
100
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Enqueues a batch of mutations to be run.
|
|
102
|
+
* Each mutation will be run independently, and the onComplete handler will
|
|
103
|
+
* be called for each mutation.
|
|
104
|
+
*
|
|
105
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
106
|
+
* @param fn - The mutation to run, like `internal.example.myMutation`.
|
|
107
|
+
* @param argsArray - The arguments to pass to the mutations.
|
|
108
|
+
* @param options - The options for the mutations to specify onComplete handling
|
|
109
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
110
|
+
*/
|
|
111
|
+
async enqueueMutationBatch(ctx, fn, argsArray, options) {
|
|
112
|
+
return enqueueBatch(this.component, ctx, "mutation", fn, argsArray, {
|
|
113
|
+
...this.options,
|
|
114
|
+
...options,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Enqueues a query to be run.
|
|
119
|
+
* Usually not what you want, but it can be useful during workflows.
|
|
120
|
+
* The query is run in a mutation and the result is returned to the caller,
|
|
121
|
+
* so it can conflict if other mutations are writing the value.
|
|
122
|
+
*
|
|
123
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
124
|
+
* @param fn - The query to run, like `internal.example.myQuery`.
|
|
125
|
+
* @param fnArgs - The arguments to pass to the query.
|
|
126
|
+
* @param options - The options for the query to specify onComplete handling
|
|
127
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
128
|
+
*/
|
|
101
129
|
async enqueueQuery(ctx, fn, fnArgs, options) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
130
|
+
return enqueue(this.component, ctx, "query", fn, fnArgs, {
|
|
131
|
+
...this.options,
|
|
132
|
+
...options,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Enqueues a batch of queries to be run.
|
|
137
|
+
* Each query will be run independently, and the onComplete handler will
|
|
138
|
+
* be called for each query.
|
|
139
|
+
*
|
|
140
|
+
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
141
|
+
* @param fn - The query to run, like `internal.example.myQuery`.
|
|
142
|
+
* @param argsArray - The arguments to pass to the queries.
|
|
143
|
+
* @param options - The options for the queries to specify onComplete handling
|
|
144
|
+
* and scheduling via `runAt` or `runAfter`.
|
|
145
|
+
*/
|
|
146
|
+
async enqueueQueryBatch(ctx, fn, argsArray, options) {
|
|
147
|
+
return enqueueBatch(this.component, ctx, "query", fn, argsArray, {
|
|
148
|
+
...this.options,
|
|
149
|
+
...options,
|
|
114
150
|
});
|
|
115
|
-
return id;
|
|
116
151
|
}
|
|
117
152
|
/**
|
|
118
153
|
* Cancels a work item. If it's already started, it will be allowed to finish
|
|
@@ -132,9 +167,10 @@ export class Workpool {
|
|
|
132
167
|
*
|
|
133
168
|
* @param ctx - The mutation or action context that can call ctx.runMutation.
|
|
134
169
|
*/
|
|
135
|
-
async cancelAll(ctx) {
|
|
170
|
+
async cancelAll(ctx, options) {
|
|
136
171
|
await ctx.runMutation(this.component.lib.cancelAll, {
|
|
137
172
|
logLevel: this.options.logLevel ?? DEFAULT_LOG_LEVEL,
|
|
173
|
+
...options,
|
|
138
174
|
});
|
|
139
175
|
}
|
|
140
176
|
/**
|
|
@@ -150,6 +186,16 @@ export class Workpool {
|
|
|
150
186
|
async status(ctx, id) {
|
|
151
187
|
return ctx.runQuery(this.component.lib.status, { id });
|
|
152
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Gets the status of a batch of work items.
|
|
191
|
+
*
|
|
192
|
+
* @param ctx - The query context that can call ctx.runQuery.
|
|
193
|
+
* @param ids - The IDs of the work to get the status of.
|
|
194
|
+
* @returns The status of the work items.
|
|
195
|
+
*/
|
|
196
|
+
async statusBatch(ctx, ids) {
|
|
197
|
+
return ctx.runQuery(this.component.lib.statusBatch, { ids });
|
|
198
|
+
}
|
|
153
199
|
/**
|
|
154
200
|
* Defines a mutation that will be run after a work item completes.
|
|
155
201
|
* You can pass this to a call to enqueue* like so:
|
|
@@ -214,16 +260,25 @@ function getRetryBehavior(defaultRetryBehavior, retryActionsByDefault, retryOver
|
|
|
214
260
|
}
|
|
215
261
|
return retryOverride ?? (retryByDefault ? defaultRetry : undefined);
|
|
216
262
|
}
|
|
217
|
-
async function
|
|
263
|
+
async function enqueueArgs(fn, opts) {
|
|
218
264
|
const [fnHandle, fnName] = typeof fn === "string" && fn.startsWith("function://")
|
|
219
|
-
? [fn, name ?? fn]
|
|
220
|
-
: [await createFunctionHandle(fn), name ?? safeFunctionName(fn)];
|
|
265
|
+
? [fn, opts?.name ?? fn]
|
|
266
|
+
: [await createFunctionHandle(fn), opts?.name ?? safeFunctionName(fn)];
|
|
267
|
+
const onComplete = opts?.onComplete
|
|
268
|
+
? {
|
|
269
|
+
fnHandle: await createFunctionHandle(opts.onComplete),
|
|
270
|
+
context: opts.context,
|
|
271
|
+
}
|
|
272
|
+
: undefined;
|
|
221
273
|
return {
|
|
222
274
|
fnHandle,
|
|
223
275
|
fnName,
|
|
276
|
+
onComplete,
|
|
277
|
+
runAt: getRunAt(opts),
|
|
278
|
+
retryBehavior: opts?.retryBehavior,
|
|
224
279
|
config: {
|
|
225
|
-
logLevel: logLevel ?? DEFAULT_LOG_LEVEL,
|
|
226
|
-
maxParallelism: maxParallelism ?? DEFAULT_MAX_PARALLELISM,
|
|
280
|
+
logLevel: opts?.logLevel ?? DEFAULT_LOG_LEVEL,
|
|
281
|
+
maxParallelism: opts?.maxParallelism ?? DEFAULT_MAX_PARALLELISM,
|
|
227
282
|
},
|
|
228
283
|
};
|
|
229
284
|
}
|
|
@@ -231,12 +286,32 @@ function getRunAt(options) {
|
|
|
231
286
|
if (!options) {
|
|
232
287
|
return Date.now();
|
|
233
288
|
}
|
|
234
|
-
if (
|
|
289
|
+
if (options.runAt !== undefined) {
|
|
235
290
|
return options.runAt;
|
|
236
291
|
}
|
|
237
|
-
if (
|
|
292
|
+
if (options.runAfter !== undefined) {
|
|
238
293
|
return Date.now() + options.runAfter;
|
|
239
294
|
}
|
|
240
295
|
return Date.now();
|
|
241
296
|
}
|
|
297
|
+
export async function enqueueBatch(component, ctx, fnType, fn, fnArgsArray, options) {
|
|
298
|
+
const { config, ...defaults } = await enqueueArgs(fn, options);
|
|
299
|
+
const ids = await ctx.runMutation(component.lib.enqueueBatch, {
|
|
300
|
+
items: fnArgsArray.map((fnArgs) => ({
|
|
301
|
+
...defaults,
|
|
302
|
+
fnArgs,
|
|
303
|
+
fnType,
|
|
304
|
+
})),
|
|
305
|
+
config,
|
|
306
|
+
});
|
|
307
|
+
return ids;
|
|
308
|
+
}
|
|
309
|
+
export async function enqueue(component, ctx, fnType, fn, fnArgs, options) {
|
|
310
|
+
const id = await ctx.runMutation(component.lib.enqueue, {
|
|
311
|
+
...(await enqueueArgs(fn, options)),
|
|
312
|
+
fnArgs,
|
|
313
|
+
fnType,
|
|
314
|
+
});
|
|
315
|
+
return id;
|
|
316
|
+
}
|
|
242
317
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAQpB,uBAAuB,GAExB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAS,CAAC,EAA4B,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAiB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAEL,uBAAuB,EAEvB,gBAAgB,GAKjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAGL,gBAAgB,GAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAsC,CAAC;AAChE,OAAO,EAAE,aAAa,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AAE/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAqB,CAAC;AAC9D,OAAO;AACL,kDAAkD;AAClD,gBAAgB,IAAI,eAAe;AACnC,kDAAkD;AAClD,gBAAgB,IAAI,eAAe,GACpC,CAAC;AACF,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AACpD,mDAAmD;AACnD,MAAM,CAAC,MAAM,oBAAo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ings":"AACA,OAAO,EAAoB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGvE,OAAO,EAEL,MAAM,
|
|
1
|
+
{"version":3,"file":"kick.d.ts","sourceRoot":"","sources":["../../../src/component/kick.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGvE,OAAO,EAEL,MAAM,EAOP,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,EAClD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GACvB,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED,eAAO,MAAM,SAAS,2EAOpB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { internal } from "./_generated/api.js";
|
|
|
2
2
|
import { internalMutation } from "./_generated/server.js";
|
|
3
3
|
import { createLogger, DEFAULT_LOG_LEVEL } from "./logging.js";
|
|
4
4
|
import { INITIAL_STATE } from "./loop.js";
|
|
5
|
-
import { boundScheduledTime, DEFAULT_MAX_PARALLELISM, fromSegment, getCurrentSegment, getNextSegment, } from "./shared.js";
|
|
5
|
+
import { boundScheduledTime, DEFAULT_MAX_PARALLELISM, fromSegment, getCurrentSegment, getNextSegment, SECOND, toSegment, } from "./shared.js";
|
|
6
6
|
/**
|
|
7
7
|
* Called from outside the loop.
|
|
8
8
|
* Returns the soonest segment to enqueue work for the main loop.
|
|
@@ -23,7 +23,7 @@ export async function kickMainLoop(ctx, source, config) {
|
|
|
23
23
|
console.debug(`[${source}] main is saturated, so we don't need to kick it`);
|
|
24
24
|
return next;
|
|
25
25
|
}
|
|
26
|
-
if (runStatus.state.segment <=
|
|
26
|
+
if (runStatus.state.segment <= toSegment(Date.now() + SECOND)) {
|
|
27
27
|
console.debug(`[${source}] main is scheduled to run soon enough, so we don't need to kick it`);
|
|
28
28
|
return next;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kick.js","sourceRoot":"","sources":["../../../src/component/kick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAe,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAElB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"kick.js","sourceRoot":"","sources":["../../../src/component/kick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAe,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAElB,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,SAAS,GACV,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAgB,EAChB,MAAkD,EAClD,MAAwB;IAExB,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAE9B,mDAAmD;IACnD,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,C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AC;QACjB,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Id } from "./_generated/dataModel.js";
|
|
1
2
|
export declare const enqueue: import("convex/server").RegisteredMutation<"public", {
|
|
2
3
|
onComplete?: {
|
|
3
4
|
context?: any;
|
|
@@ -18,16 +19,41 @@ export declare const enqueue: import("convex/server").RegisteredMutation<"public
|
|
|
18
19
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
19
20
|
};
|
|
20
21
|
}, Promise<import("convex/values").GenericId<"work">>>;
|
|
22
|
+
export declare const enqueueBatch: import("convex/server").RegisteredMutation<"public", {
|
|
23
|
+
config: {
|
|
24
|
+
maxParallelism: number;
|
|
25
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
26
|
+
};
|
|
27
|
+
items: {
|
|
28
|
+
onComplete?: {
|
|
29
|
+
context?: any;
|
|
30
|
+
fnHandle: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
retryBehavior?: {
|
|
33
|
+
maxAttempts: number;
|
|
34
|
+
initialBackoffMs: number;
|
|
35
|
+
base: number;
|
|
36
|
+
} | undefined;
|
|
37
|
+
fnHandle: string;
|
|
38
|
+
fnType: "action" | "mutation" | "query";
|
|
39
|
+
fnName: string;
|
|
40
|
+
fnArgs: any;
|
|
41
|
+
runAt: number;
|
|
42
|
+
}[];
|
|
43
|
+
}, Promise<(string & {
|
|
44
|
+
__tableName: "work";
|
|
45
|
+
})[]>>;
|
|
21
46
|
export declare const cancel: import("convex/server").RegisteredMutation<"public", {
|
|
22
47
|
id: import("convex/values").GenericId<"work">;
|
|
23
48
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
24
49
|
}, Promise<void>>;
|
|
25
50
|
export declare const cancelAll: import("convex/server").RegisteredMutation<"public", {
|
|
26
51
|
before?: number | undefined;
|
|
52
|
+
limit?: number | undefined;
|
|
27
53
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
28
54
|
}, Promise<void>>;
|
|
29
55
|
export declare const status: import("convex/server").RegisteredQuery<"public", {
|
|
30
|
-
id:
|
|
56
|
+
id: Id<"work">;
|
|
31
57
|
}, Promise<{
|
|
32
58
|
readonly state: "finished";
|
|
33
59
|
readonly previousAttempts?: undefined;
|
|
@@ -38,4 +64,16 @@ export declare const status: import("convex/server").RegisteredQuery<"public", {
|
|
|
38
64
|
readonly state: "running";
|
|
39
65
|
readonly previousAttempts: number;
|
|
40
66
|
}>>;
|
|
67
|
+
export declare const statusBatch: import("convex/server").RegisteredQuery<"public", {
|
|
68
|
+
ids: import("convex/values").GenericId<"work">[];
|
|
69
|
+
}, Promise<({
|
|
70
|
+
readonly state: "finished";
|
|
71
|
+
readonly previousAttempts?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
readonly state: "pending";
|
|
74
|
+
readonly previousAttempts: number;
|
|
75
|
+
} | {
|
|
76
|
+
readonly state: "running";
|
|
77
|
+
readonly previousAttempts: number;
|
|
78
|
+
})[]>>;
|
|
41
79
|
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/component/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/component/lib.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAiC/C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;sDASlB,CAAC;AAiCH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;MAcvB,CAAC;AAEH,eAAO,MAAM,MAAM;;;iBAejB,CAAC;AAGH,eAAO,MAAM,SAAS;;;;iBAwCpB,CAAC;AAEH,eAAO,MAAM,MAAM;QAKuC,EAAE,CAAC,MAAM,CAAC;;;;;;;;;;GADlE,CAAC;AAwBH,eAAO,MAAM,WAAW;;;;;;;;;;;MAQtB,CAAC"}
|