@convex-dev/workpool 0.2.19 → 0.3.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 +77 -68
- package/dist/client/index.d.ts +7 -8
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -8
- package/dist/client/index.js.map +1 -1
- package/dist/client/utils.d.ts +1 -8
- package/dist/client/utils.d.ts.map +1 -1
- package/dist/client/utils.js.map +1 -1
- package/dist/component/_generated/api.d.ts +27 -124
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js +10 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +98 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +4 -18
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js +9 -5
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/danger.d.ts +2 -2
- package/dist/component/lib.d.ts +9 -9
- package/dist/component/schema.d.ts +15 -15
- package/dist/component/shared.d.ts +4 -3
- package/dist/component/shared.d.ts.map +1 -1
- package/dist/component/shared.js +6 -0
- package/dist/component/shared.js.map +1 -1
- package/dist/component/stats.d.ts +2 -2
- package/dist/component/worker.d.ts +3 -3
- package/package.json +32 -30
- package/src/client/index.ts +23 -29
- package/src/client/utils.ts +3 -32
- package/src/component/README.md +6 -6
- package/src/component/_generated/api.ts +70 -0
- package/src/component/_generated/component.ts +117 -0
- package/src/component/_generated/{server.d.ts → server.ts} +33 -21
- package/src/component/complete.test.ts +1 -1
- package/src/component/complete.ts +6 -6
- package/src/component/danger.ts +3 -3
- package/src/component/kick.test.ts +5 -5
- package/src/component/kick.ts +6 -6
- package/src/component/lib.test.ts +3 -3
- package/src/component/lib.ts +8 -8
- package/src/component/logging.ts +2 -2
- package/src/component/loop.test.ts +9 -9
- package/src/component/loop.ts +33 -33
- package/src/component/recovery.test.ts +7 -7
- package/src/component/recovery.ts +2 -2
- package/src/component/schema.ts +2 -2
- package/src/component/shared.ts +11 -5
- package/src/component/stats.test.ts +3 -3
- package/src/component/stats.ts +6 -6
- package/src/test.ts +10 -3
- package/src/component/_generated/api.d.ts +0 -151
- package/src/component/_generated/api.js +0 -23
- package/src/component/_generated/server.js +0 -90
- /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/component/shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAe,QAAQ,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EACnB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,UAAU,GAAG,GAAG,CAAC;AACvB,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAC3B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC;AAClC,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC;AAC7B,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAE9B,MAAM,UAAU,SAAS,CAAC,EAAU;IAClC,O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AAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CAAmB,CAAI,EAAE,CAAI;IAC9C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -15,6 +15,8 @@ export declare function recordStarted(console: Logger, work: Doc<"work">, lagMs:
|
|
|
15
15
|
export declare function recordCompleted(console: Logger, work: Doc<"work">, status: "success" | "failed" | "canceled" | "retrying"): void;
|
|
16
16
|
export declare function generateReport(ctx: MutationCtx, console: Logger, state: Doc<"internalState">, { maxParallelism, logLevel }: Config): Promise<void>;
|
|
17
17
|
export declare const calculateBacklogAndReport: import("convex/server").RegisteredMutation<"internal", {
|
|
18
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
19
|
+
running: number;
|
|
18
20
|
report: {
|
|
19
21
|
failed: number;
|
|
20
22
|
canceled: number;
|
|
@@ -23,8 +25,6 @@ export declare const calculateBacklogAndReport: import("convex/server").Register
|
|
|
23
25
|
retries: number;
|
|
24
26
|
lastReportTs: number;
|
|
25
27
|
};
|
|
26
|
-
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
27
|
-
running: number;
|
|
28
28
|
cursor: string;
|
|
29
29
|
startSegment: bigint;
|
|
30
30
|
endSegment: bigint;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export declare const runMutationWrapper: import("convex/server").RegisteredMutation<"internal", {
|
|
2
2
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
3
|
+
fnArgs: any;
|
|
3
4
|
fnHandle: string;
|
|
4
|
-
workId: import("convex/values").GenericId<"work">;
|
|
5
5
|
fnType: "mutation" | "query";
|
|
6
|
-
|
|
6
|
+
workId: import("convex/values").GenericId<"work">;
|
|
7
7
|
attempt: number;
|
|
8
8
|
}, Promise<void>>;
|
|
9
9
|
export declare const runActionWrapper: import("convex/server").RegisteredAction<"internal", {
|
|
10
10
|
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
11
|
+
fnArgs: any;
|
|
11
12
|
fnHandle: string;
|
|
12
13
|
workId: import("convex/values").GenericId<"work">;
|
|
13
|
-
fnArgs: any;
|
|
14
14
|
attempt: number;
|
|
15
15
|
}, Promise<void>>;
|
|
16
16
|
//# sourceMappingURL=worker.d.ts.map
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"email": "support@convex.dev",
|
|
8
8
|
"url": "https://github.com/get-convex/workpool/issues"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.3.0",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"convex",
|
|
@@ -19,78 +19,80 @@
|
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"dev": "run-p -r 'dev
|
|
23
|
-
"dev:backend": "convex dev --
|
|
22
|
+
"dev": "run-p -r 'dev:*'",
|
|
23
|
+
"dev:backend": "convex dev --typecheck-components",
|
|
24
24
|
"dev:frontend": "cd example && vite --clearScreen false",
|
|
25
|
+
"dev:build": "chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'convex codegen --component-dir ./src/component && npm run build' --initial",
|
|
25
26
|
"predev": "npm run dev:backend -- --until-success",
|
|
26
|
-
"clean": "rm -rf dist
|
|
27
|
-
"build": "tsc --project ./tsconfig.build.json
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"lint": "eslint src && eslint example/convex",
|
|
32
|
-
"all": "run-p -r 'dev:backend' 'dev:frontend' 'build:watch' 'test:watch'",
|
|
27
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
28
|
+
"build": "tsc --project ./tsconfig.build.json",
|
|
29
|
+
"typecheck": "tsc --noEmit && tsc -p example && tsc -p example/convex",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"all": "run-p -r 'dev:*' 'test:watch'",
|
|
33
32
|
"test": "vitest run --typecheck",
|
|
34
33
|
"test:watch": "vitest --typecheck --clearScreen false",
|
|
35
34
|
"test:debug": "vitest --inspect-brk --no-file-parallelism",
|
|
36
35
|
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
37
|
-
"attw": "attw $(npm pack -s) --exclude-entrypoints ./convex.config --profile esm-only",
|
|
38
36
|
"prepare": "npm run build",
|
|
39
|
-
"alpha": "npm run clean && npm ci && run-p test lint typecheck
|
|
40
|
-
"release": "npm run clean && npm ci && run-p test lint typecheck
|
|
37
|
+
"alpha": "npm run clean && npm ci && run-p test lint typecheck && npm version prerelease --preid alpha && npm publish --tag alpha && git push --tags",
|
|
38
|
+
"release": "npm run clean && npm ci && run-p test lint typecheck && npm version patch && npm publish && git push --tags",
|
|
41
39
|
"version": "pbcopy <<<$npm_package_version; vim CHANGELOG.md && prettier -w CHANGELOG.md && git add CHANGELOG.md"
|
|
42
40
|
},
|
|
43
41
|
"files": [
|
|
44
42
|
"dist",
|
|
45
|
-
"src"
|
|
46
|
-
"react"
|
|
43
|
+
"src"
|
|
47
44
|
],
|
|
48
45
|
"exports": {
|
|
49
46
|
"./package.json": "./package.json",
|
|
50
47
|
".": {
|
|
51
|
-
"@convex-dev/component-source": "./src/client/index.ts",
|
|
52
48
|
"types": "./dist/client/index.d.ts",
|
|
53
49
|
"default": "./dist/client/index.js"
|
|
54
50
|
},
|
|
55
51
|
"./test": "./src/test.ts",
|
|
52
|
+
"./_generated/component.js": {
|
|
53
|
+
"types": "./dist/component/_generated/component.d.ts"
|
|
54
|
+
},
|
|
56
55
|
"./convex.config": {
|
|
57
|
-
"
|
|
56
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
57
|
+
"default": "./dist/component/convex.config.js"
|
|
58
|
+
},
|
|
59
|
+
"./convex.config.js": {
|
|
58
60
|
"types": "./dist/component/convex.config.d.ts",
|
|
59
61
|
"default": "./dist/component/convex.config.js"
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
"peerDependencies": {
|
|
63
|
-
"convex": "
|
|
65
|
+
"convex": "^1.24.8",
|
|
64
66
|
"convex-helpers": "^0.1.94"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
|
-
"@arethetypeswrong/cli": "0.18.2",
|
|
68
69
|
"@edge-runtime/vm": "5.0.0",
|
|
69
70
|
"@eslint/eslintrc": "3.3.1",
|
|
70
|
-
"@eslint/js": "9.
|
|
71
|
-
"@types/node": "
|
|
71
|
+
"@eslint/js": "9.39.1",
|
|
72
|
+
"@types/node": "20.19.24",
|
|
72
73
|
"@types/react": "19.2.2",
|
|
73
74
|
"@types/react-dom": "19.2.2",
|
|
74
|
-
"@vitejs/plugin-react": "5.0
|
|
75
|
+
"@vitejs/plugin-react": "5.1.0",
|
|
75
76
|
"@vitest/coverage-v8": "3.2.4",
|
|
76
77
|
"chokidar-cli": "3.0.0",
|
|
78
|
+
"convex": "1.29.0",
|
|
79
|
+
"convex-helpers": "0.1.104",
|
|
77
80
|
"convex-test": "0.0.38",
|
|
78
81
|
"cpy-cli": "6.0.0",
|
|
79
|
-
"eslint": "9.
|
|
80
|
-
"eslint-plugin-react-hooks": "7.0.
|
|
82
|
+
"eslint": "9.39.1",
|
|
83
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
81
84
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
82
|
-
"globals": "16.
|
|
85
|
+
"globals": "16.5.0",
|
|
83
86
|
"npm-run-all2": "8.0.4",
|
|
84
87
|
"pkg-pr-new": "0.0.60",
|
|
85
88
|
"prettier": "3.6.2",
|
|
86
89
|
"react": "19.2.0",
|
|
87
90
|
"react-dom": "19.2.0",
|
|
88
91
|
"typescript": "5.9.3",
|
|
89
|
-
"typescript-eslint": "8.
|
|
90
|
-
"vite": "7.1.
|
|
92
|
+
"typescript-eslint": "8.46.3",
|
|
93
|
+
"vite": "7.1.12",
|
|
91
94
|
"vitest": "3.2.4"
|
|
92
95
|
},
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"module": "./dist/esm/client/index.js"
|
|
96
|
+
"types": "./dist/client/index.d.ts",
|
|
97
|
+
"module": "./dist/client/index.js"
|
|
96
98
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -17,11 +17,12 @@ import {
|
|
|
17
17
|
type VAny,
|
|
18
18
|
type VString,
|
|
19
19
|
} from "convex/values";
|
|
20
|
-
import type {
|
|
20
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
21
21
|
import { DEFAULT_LOG_LEVEL, type LogLevel } from "../component/logging.js";
|
|
22
22
|
import {
|
|
23
23
|
type Config,
|
|
24
24
|
DEFAULT_MAX_PARALLELISM,
|
|
25
|
+
DEFAULT_RETRY_BEHAVIOR,
|
|
25
26
|
type OnComplete,
|
|
26
27
|
type RetryBehavior,
|
|
27
28
|
type RunResult,
|
|
@@ -33,14 +34,15 @@ import {
|
|
|
33
34
|
type RunMutationCtx,
|
|
34
35
|
type RunQueryCtx,
|
|
35
36
|
safeFunctionName,
|
|
36
|
-
type UseApi,
|
|
37
37
|
} from "./utils.js";
|
|
38
38
|
export { logLevel as vLogLevel, type LogLevel } from "../component/logging.js";
|
|
39
39
|
export { retryBehavior as vRetryBehavior } from "../component/shared.js";
|
|
40
40
|
export { vResultValidator, type RetryBehavior, type RunResult };
|
|
41
|
+
|
|
41
42
|
export type WorkId = string & { __isWorkId: true };
|
|
42
43
|
export const vWorkIdValidator = v.string() as VString<WorkId>;
|
|
43
44
|
export {
|
|
45
|
+
DEFAULT_RETRY_BEHAVIOR,
|
|
44
46
|
/** @deprecated Use `vResultValidator` instead. */
|
|
45
47
|
vResultValidator as resultValidator,
|
|
46
48
|
/** @deprecated Use `vWorkIdValidator` instead. */
|
|
@@ -51,15 +53,7 @@ export const vOnComplete = vOnCompleteArgs(v.any());
|
|
|
51
53
|
/** @deprecated Use `vOnCompleteArgs()` instead. */
|
|
52
54
|
export const vOnCompleteValidator = vOnCompleteArgs;
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
export const DEFAULT_RETRY_BEHAVIOR: RetryBehavior = {
|
|
56
|
-
maxAttempts: 5,
|
|
57
|
-
initialBackoffMs: 250,
|
|
58
|
-
base: 2,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
// UseApi<api> for jump to definition
|
|
62
|
-
export type WorkpoolComponent = UseApi<Mounts>;
|
|
56
|
+
export type WorkpoolComponent = ComponentApi;
|
|
63
57
|
|
|
64
58
|
export class Workpool {
|
|
65
59
|
/**
|
|
@@ -75,7 +69,7 @@ export class Workpool {
|
|
|
75
69
|
*/
|
|
76
70
|
constructor(
|
|
77
71
|
public component: WorkpoolComponent,
|
|
78
|
-
public options: WorkpoolOptions
|
|
72
|
+
public options: WorkpoolOptions,
|
|
79
73
|
) {}
|
|
80
74
|
|
|
81
75
|
/**
|
|
@@ -92,12 +86,12 @@ export class Workpool {
|
|
|
92
86
|
ctx: RunMutationCtx,
|
|
93
87
|
fn: FunctionReference<"action", FunctionVisibility, Args, ReturnType>,
|
|
94
88
|
fnArgs: Args,
|
|
95
|
-
options?: RetryOption & EnqueueOptions
|
|
89
|
+
options?: RetryOption & EnqueueOptions,
|
|
96
90
|
): Promise<WorkId> {
|
|
97
91
|
const retryBehavior = getRetryBehavior(
|
|
98
92
|
this.options.defaultRetryBehavior,
|
|
99
93
|
this.options.retryActionsByDefault,
|
|
100
|
-
options?.retry
|
|
94
|
+
options?.retry,
|
|
101
95
|
);
|
|
102
96
|
return enqueue(this.component, ctx, "action", fn, fnArgs, {
|
|
103
97
|
retryBehavior,
|
|
@@ -122,12 +116,12 @@ export class Workpool {
|
|
|
122
116
|
ctx: RunMutationCtx,
|
|
123
117
|
fn: FunctionReference<"action", FunctionVisibility, Args, ReturnType>,
|
|
124
118
|
argsArray: Array<Args>,
|
|
125
|
-
options?: RetryOption & EnqueueOptions
|
|
119
|
+
options?: RetryOption & EnqueueOptions,
|
|
126
120
|
): Promise<WorkId[]> {
|
|
127
121
|
const retryBehavior = getRetryBehavior(
|
|
128
122
|
this.options.defaultRetryBehavior,
|
|
129
123
|
this.options.retryActionsByDefault,
|
|
130
|
-
options?.retry
|
|
124
|
+
options?.retry,
|
|
131
125
|
);
|
|
132
126
|
return enqueueBatch(this.component, ctx, "action", fn, argsArray, {
|
|
133
127
|
retryBehavior,
|
|
@@ -153,7 +147,7 @@ export class Workpool {
|
|
|
153
147
|
ctx: RunMutationCtx,
|
|
154
148
|
fn: FunctionReference<"mutation", FunctionVisibility, Args, ReturnType>,
|
|
155
149
|
fnArgs: Args,
|
|
156
|
-
options?: EnqueueOptions
|
|
150
|
+
options?: EnqueueOptions,
|
|
157
151
|
): Promise<WorkId> {
|
|
158
152
|
return enqueue(this.component, ctx, "mutation", fn, fnArgs, {
|
|
159
153
|
...this.options,
|
|
@@ -175,7 +169,7 @@ export class Workpool {
|
|
|
175
169
|
ctx: RunMutationCtx,
|
|
176
170
|
fn: FunctionReference<"mutation", FunctionVisibility, Args, ReturnType>,
|
|
177
171
|
argsArray: Array<Args>,
|
|
178
|
-
options?: EnqueueOptions
|
|
172
|
+
options?: EnqueueOptions,
|
|
179
173
|
): Promise<WorkId[]> {
|
|
180
174
|
return enqueueBatch(this.component, ctx, "mutation", fn, argsArray, {
|
|
181
175
|
...this.options,
|
|
@@ -199,7 +193,7 @@ export class Workpool {
|
|
|
199
193
|
ctx: RunMutationCtx,
|
|
200
194
|
fn: FunctionReference<"query", FunctionVisibility, Args, ReturnType>,
|
|
201
195
|
fnArgs: Args,
|
|
202
|
-
options?: EnqueueOptions
|
|
196
|
+
options?: EnqueueOptions,
|
|
203
197
|
): Promise<WorkId> {
|
|
204
198
|
return enqueue(this.component, ctx, "query", fn, fnArgs, {
|
|
205
199
|
...this.options,
|
|
@@ -222,7 +216,7 @@ export class Workpool {
|
|
|
222
216
|
ctx: RunMutationCtx,
|
|
223
217
|
fn: FunctionReference<"query", FunctionVisibility, Args, ReturnType>,
|
|
224
218
|
argsArray: Array<Args>,
|
|
225
|
-
options?: EnqueueOptions
|
|
219
|
+
options?: EnqueueOptions,
|
|
226
220
|
): Promise<WorkId[]> {
|
|
227
221
|
return enqueueBatch(this.component, ctx, "query", fn, argsArray, {
|
|
228
222
|
...this.options,
|
|
@@ -250,7 +244,7 @@ export class Workpool {
|
|
|
250
244
|
*/
|
|
251
245
|
async cancelAll(
|
|
252
246
|
ctx: RunMutationCtx,
|
|
253
|
-
options?: { limit?: number }
|
|
247
|
+
options?: { limit?: number },
|
|
254
248
|
): Promise<void> {
|
|
255
249
|
await ctx.runMutation(this.component.lib.cancelAll, {
|
|
256
250
|
logLevel: this.options.logLevel ?? DEFAULT_LOG_LEVEL,
|
|
@@ -315,7 +309,7 @@ export class Workpool {
|
|
|
315
309
|
workId: WorkId;
|
|
316
310
|
context: Infer<V>;
|
|
317
311
|
result: RunResult;
|
|
318
|
-
}
|
|
312
|
+
},
|
|
319
313
|
) => Promise<void>;
|
|
320
314
|
}): RegisteredMutation<"internal", OnCompleteArgs, null> {
|
|
321
315
|
return internalMutationGeneric({
|
|
@@ -476,7 +470,7 @@ const _ = {} as OnCompleteArgs satisfies SharedOnCompleteArgs;
|
|
|
476
470
|
function getRetryBehavior(
|
|
477
471
|
defaultRetryBehavior: RetryBehavior | undefined,
|
|
478
472
|
retryActionsByDefault: boolean | undefined,
|
|
479
|
-
retryOverride: boolean | RetryBehavior | undefined
|
|
473
|
+
retryOverride: boolean | RetryBehavior | undefined,
|
|
480
474
|
): RetryBehavior | undefined {
|
|
481
475
|
const defaultRetry = defaultRetryBehavior ?? DEFAULT_RETRY_BEHAVIOR;
|
|
482
476
|
const retryByDefault = retryActionsByDefault ?? false;
|
|
@@ -495,7 +489,7 @@ async function enqueueArgs(
|
|
|
495
489
|
| FunctionHandle<FunctionType, DefaultFunctionArgs>,
|
|
496
490
|
opts:
|
|
497
491
|
| (EnqueueOptions & Partial<Config> & { retryBehavior?: RetryBehavior })
|
|
498
|
-
| undefined
|
|
492
|
+
| undefined,
|
|
499
493
|
) {
|
|
500
494
|
const [fnHandle, fnName] =
|
|
501
495
|
typeof fn === "string" && fn.startsWith("function://")
|
|
@@ -526,7 +520,7 @@ function getRunAt(
|
|
|
526
520
|
runAt?: number;
|
|
527
521
|
runAfter?: number;
|
|
528
522
|
}
|
|
529
|
-
| undefined
|
|
523
|
+
| undefined,
|
|
530
524
|
): number {
|
|
531
525
|
if (!options) {
|
|
532
526
|
return Date.now();
|
|
@@ -545,7 +539,7 @@ export async function enqueueBatch<
|
|
|
545
539
|
Args extends DefaultFunctionArgs,
|
|
546
540
|
ReturnType,
|
|
547
541
|
>(
|
|
548
|
-
component:
|
|
542
|
+
component: WorkpoolComponent,
|
|
549
543
|
ctx: RunMutationCtx,
|
|
550
544
|
fnType: FnType,
|
|
551
545
|
fn: FunctionReference<FnType, FunctionVisibility, Args, ReturnType>,
|
|
@@ -554,7 +548,7 @@ export async function enqueueBatch<
|
|
|
554
548
|
retryBehavior?: RetryBehavior;
|
|
555
549
|
maxParallelism?: number;
|
|
556
550
|
logLevel?: LogLevel;
|
|
557
|
-
}
|
|
551
|
+
},
|
|
558
552
|
): Promise<WorkId[]> {
|
|
559
553
|
const { config, ...defaults } = await enqueueArgs(fn, options);
|
|
560
554
|
const ids = await ctx.runMutation(component.lib.enqueueBatch, {
|
|
@@ -573,7 +567,7 @@ export async function enqueue<
|
|
|
573
567
|
Args extends DefaultFunctionArgs,
|
|
574
568
|
ReturnType,
|
|
575
569
|
>(
|
|
576
|
-
component:
|
|
570
|
+
component: WorkpoolComponent,
|
|
577
571
|
ctx: RunMutationCtx,
|
|
578
572
|
fnType: FnType,
|
|
579
573
|
fn: FunctionReference<FnType, FunctionVisibility, Args, ReturnType>,
|
|
@@ -582,7 +576,7 @@ export async function enqueue<
|
|
|
582
576
|
retryBehavior?: RetryBehavior;
|
|
583
577
|
maxParallelism?: number;
|
|
584
578
|
logLevel?: LogLevel;
|
|
585
|
-
}
|
|
579
|
+
},
|
|
586
580
|
): Promise<WorkId> {
|
|
587
581
|
const id = await ctx.runMutation(component.lib.enqueue, {
|
|
588
582
|
...(await enqueueArgs(fn, options)),
|
package/src/client/utils.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type Expand,
|
|
3
2
|
type FunctionArgs,
|
|
4
3
|
type FunctionReference,
|
|
5
4
|
type FunctionReturnType,
|
|
@@ -8,52 +7,24 @@ import {
|
|
|
8
7
|
getFunctionAddress,
|
|
9
8
|
getFunctionName,
|
|
10
9
|
} from "convex/server";
|
|
11
|
-
import type { GenericId } from "convex/values";
|
|
12
10
|
|
|
13
11
|
/* Type utils follow */
|
|
14
12
|
|
|
15
13
|
export type RunQueryCtx = {
|
|
16
14
|
runQuery: <Query extends FunctionReference<"query", "internal">>(
|
|
17
15
|
query: Query,
|
|
18
|
-
args: FunctionArgs<Query
|
|
16
|
+
args: FunctionArgs<Query>,
|
|
19
17
|
) => Promise<FunctionReturnType<Query>>;
|
|
20
18
|
};
|
|
21
19
|
export type RunMutationCtx = RunQueryCtx & {
|
|
22
20
|
runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(
|
|
23
21
|
mutation: Mutation,
|
|
24
|
-
args: FunctionArgs<Mutation
|
|
22
|
+
args: FunctionArgs<Mutation>,
|
|
25
23
|
) => Promise<FunctionReturnType<Mutation>>;
|
|
26
24
|
};
|
|
27
25
|
|
|
28
|
-
export type OpaqueIds<T> =
|
|
29
|
-
T extends GenericId<infer _T>
|
|
30
|
-
? string
|
|
31
|
-
: T extends (infer U)[]
|
|
32
|
-
? OpaqueIds<U>[]
|
|
33
|
-
: T extends object
|
|
34
|
-
? { [K in keyof T]: OpaqueIds<T[K]> }
|
|
35
|
-
: T;
|
|
36
|
-
|
|
37
|
-
export type UseApi<API> = Expand<{
|
|
38
|
-
[mod in keyof API]: API[mod] extends FunctionReference<
|
|
39
|
-
infer FType,
|
|
40
|
-
"public",
|
|
41
|
-
infer FArgs,
|
|
42
|
-
infer FReturnType,
|
|
43
|
-
infer FComponentPath
|
|
44
|
-
>
|
|
45
|
-
? FunctionReference<
|
|
46
|
-
FType,
|
|
47
|
-
"internal",
|
|
48
|
-
OpaqueIds<FArgs>,
|
|
49
|
-
OpaqueIds<FReturnType>,
|
|
50
|
-
FComponentPath
|
|
51
|
-
>
|
|
52
|
-
: UseApi<API[mod]>;
|
|
53
|
-
}>;
|
|
54
|
-
|
|
55
26
|
export function safeFunctionName(
|
|
56
|
-
f: FunctionReference<FunctionType, FunctionVisibility
|
|
27
|
+
f: FunctionReference<FunctionType, FunctionVisibility>,
|
|
57
28
|
) {
|
|
58
29
|
const address = getFunctionAddress(f);
|
|
59
30
|
return (
|
package/src/component/README.md
CHANGED
|
@@ -4,10 +4,10 @@ Concepts:
|
|
|
4
4
|
|
|
5
5
|
- `segment`: A slice of time to process work. All work is bucketed into one.
|
|
6
6
|
This enables us to batch work and avoid database conflicts.
|
|
7
|
-
- `generation`: A monotonically increasing counter to ensure the loop is
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
- `generation`: A monotonically increasing counter to ensure the loop is only
|
|
8
|
+
running one instance. If two loops start with the same generation, one will
|
|
9
|
+
successfully increase it, the other will retry and find that the generation
|
|
10
|
+
has changed and fail out.
|
|
11
11
|
- "Retention" is used to refer to situations where a query might have to read
|
|
12
12
|
over a lot of "tombstones" - deleted data that hasn't been vacuumed from the
|
|
13
13
|
underlying database yet. If there are frequent deletions, scanning across them
|
|
@@ -65,8 +65,8 @@ flowchart TD
|
|
|
65
65
|
- Producers (Client, Worker, Recovery) write to a future "segment".
|
|
66
66
|
- Consumers (main) read the current segment.
|
|
67
67
|
- On conflicts, producers will write to progressively higher segments, while
|
|
68
|
-
the main loop will continue to read the segment originally called with.
|
|
69
|
-
|
|
68
|
+
the main loop will continue to read the segment originally called with. This
|
|
69
|
+
means conflicts are less likely on each retry.
|
|
70
70
|
- Patch singletons to avoid tombstones.
|
|
71
71
|
- Use segements & cursors to bound reads to latest data.
|
|
72
72
|
- Do scans outside of the critical path (during load).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type * as complete from "../complete.js";
|
|
12
|
+
import type * as crons from "../crons.js";
|
|
13
|
+
import type * as danger from "../danger.js";
|
|
14
|
+
import type * as kick from "../kick.js";
|
|
15
|
+
import type * as lib from "../lib.js";
|
|
16
|
+
import type * as logging from "../logging.js";
|
|
17
|
+
import type * as loop from "../loop.js";
|
|
18
|
+
import type * as recovery from "../recovery.js";
|
|
19
|
+
import type * as shared from "../shared.js";
|
|
20
|
+
import type * as stats from "../stats.js";
|
|
21
|
+
import type * as worker from "../worker.js";
|
|
22
|
+
|
|
23
|
+
import type {
|
|
24
|
+
ApiFromModules,
|
|
25
|
+
FilterApi,
|
|
26
|
+
FunctionReference,
|
|
27
|
+
} from "convex/server";
|
|
28
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
29
|
+
|
|
30
|
+
const fullApi: ApiFromModules<{
|
|
31
|
+
complete: typeof complete;
|
|
32
|
+
crons: typeof crons;
|
|
33
|
+
danger: typeof danger;
|
|
34
|
+
kick: typeof kick;
|
|
35
|
+
lib: typeof lib;
|
|
36
|
+
logging: typeof logging;
|
|
37
|
+
loop: typeof loop;
|
|
38
|
+
recovery: typeof recovery;
|
|
39
|
+
shared: typeof shared;
|
|
40
|
+
stats: typeof stats;
|
|
41
|
+
worker: typeof worker;
|
|
42
|
+
}> = anyApi as any;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
46
|
+
*
|
|
47
|
+
* Usage:
|
|
48
|
+
* ```js
|
|
49
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export const api: FilterApi<
|
|
53
|
+
typeof fullApi,
|
|
54
|
+
FunctionReference<any, "public">
|
|
55
|
+
> = anyApi as any;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
59
|
+
*
|
|
60
|
+
* Usage:
|
|
61
|
+
* ```js
|
|
62
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export const internal: FilterApi<
|
|
66
|
+
typeof fullApi,
|
|
67
|
+
FunctionReference<any, "internal">
|
|
68
|
+
> = anyApi as any;
|
|
69
|
+
|
|
70
|
+
export const components = componentsGeneric() as unknown as {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `ComponentApi` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { FunctionReference } from "convex/server";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A utility for referencing a Convex component's exposed API.
|
|
15
|
+
*
|
|
16
|
+
* Useful when expecting a parameter like `components.myComponent`.
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```ts
|
|
19
|
+
* async function myFunction(ctx: QueryCtx, component: ComponentApi) {
|
|
20
|
+
* return ctx.runQuery(component.someFile.someQuery, { ...args });
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type ComponentApi<Name extends string | undefined = string | undefined> =
|
|
25
|
+
{
|
|
26
|
+
lib: {
|
|
27
|
+
cancel: FunctionReference<
|
|
28
|
+
"mutation",
|
|
29
|
+
"internal",
|
|
30
|
+
{
|
|
31
|
+
id: string;
|
|
32
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
33
|
+
},
|
|
34
|
+
any,
|
|
35
|
+
Name
|
|
36
|
+
>;
|
|
37
|
+
cancelAll: FunctionReference<
|
|
38
|
+
"mutation",
|
|
39
|
+
"internal",
|
|
40
|
+
{
|
|
41
|
+
before?: number;
|
|
42
|
+
limit?: number;
|
|
43
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
44
|
+
},
|
|
45
|
+
any,
|
|
46
|
+
Name
|
|
47
|
+
>;
|
|
48
|
+
enqueue: FunctionReference<
|
|
49
|
+
"mutation",
|
|
50
|
+
"internal",
|
|
51
|
+
{
|
|
52
|
+
config: {
|
|
53
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
54
|
+
maxParallelism: number;
|
|
55
|
+
};
|
|
56
|
+
fnArgs: any;
|
|
57
|
+
fnHandle: string;
|
|
58
|
+
fnName: string;
|
|
59
|
+
fnType: "action" | "mutation" | "query";
|
|
60
|
+
onComplete?: { context?: any; fnHandle: string };
|
|
61
|
+
retryBehavior?: {
|
|
62
|
+
base: number;
|
|
63
|
+
initialBackoffMs: number;
|
|
64
|
+
maxAttempts: number;
|
|
65
|
+
};
|
|
66
|
+
runAt: number;
|
|
67
|
+
},
|
|
68
|
+
string,
|
|
69
|
+
Name
|
|
70
|
+
>;
|
|
71
|
+
enqueueBatch: FunctionReference<
|
|
72
|
+
"mutation",
|
|
73
|
+
"internal",
|
|
74
|
+
{
|
|
75
|
+
config: {
|
|
76
|
+
logLevel: "DEBUG" | "TRACE" | "INFO" | "REPORT" | "WARN" | "ERROR";
|
|
77
|
+
maxParallelism: number;
|
|
78
|
+
};
|
|
79
|
+
items: Array<{
|
|
80
|
+
fnArgs: any;
|
|
81
|
+
fnHandle: string;
|
|
82
|
+
fnName: string;
|
|
83
|
+
fnType: "action" | "mutation" | "query";
|
|
84
|
+
onComplete?: { context?: any; fnHandle: string };
|
|
85
|
+
retryBehavior?: {
|
|
86
|
+
base: number;
|
|
87
|
+
initialBackoffMs: number;
|
|
88
|
+
maxAttempts: number;
|
|
89
|
+
};
|
|
90
|
+
runAt: number;
|
|
91
|
+
}>;
|
|
92
|
+
},
|
|
93
|
+
Array<string>,
|
|
94
|
+
Name
|
|
95
|
+
>;
|
|
96
|
+
status: FunctionReference<
|
|
97
|
+
"query",
|
|
98
|
+
"internal",
|
|
99
|
+
{ id: string },
|
|
100
|
+
| { previousAttempts: number; state: "pending" }
|
|
101
|
+
| { previousAttempts: number; state: "running" }
|
|
102
|
+
| { state: "finished" },
|
|
103
|
+
Name
|
|
104
|
+
>;
|
|
105
|
+
statusBatch: FunctionReference<
|
|
106
|
+
"query",
|
|
107
|
+
"internal",
|
|
108
|
+
{ ids: Array<string> },
|
|
109
|
+
Array<
|
|
110
|
+
| { previousAttempts: number; state: "pending" }
|
|
111
|
+
| { previousAttempts: number; state: "running" }
|
|
112
|
+
| { state: "finished" }
|
|
113
|
+
>,
|
|
114
|
+
Name
|
|
115
|
+
>;
|
|
116
|
+
};
|
|
117
|
+
};
|