@convex-dev/workpool 0.1.3-alpha.0 → 0.2.0-beta.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 +144 -4
- package/dist/commonjs/client/index.d.ts +123 -35
- package/dist/commonjs/client/index.d.ts.map +1 -1
- package/dist/commonjs/client/index.js +122 -15
- package/dist/commonjs/client/index.js.map +1 -1
- package/dist/commonjs/client/utils.d.ts +16 -0
- package/dist/commonjs/client/utils.d.ts.map +1 -0
- package/dist/commonjs/client/utils.js +2 -0
- package/dist/commonjs/client/utils.js.map +1 -0
- package/dist/commonjs/component/convex.config.d.ts.map +1 -1
- package/dist/commonjs/component/convex.config.js +0 -2
- package/dist/commonjs/component/convex.config.js.map +1 -1
- package/dist/commonjs/component/kick.d.ts +9 -0
- package/dist/commonjs/component/kick.d.ts.map +1 -0
- package/dist/commonjs/component/kick.js +97 -0
- package/dist/commonjs/component/kick.js.map +1 -0
- package/dist/commonjs/component/lib.d.ts +23 -32
- package/dist/commonjs/component/lib.d.ts.map +1 -1
- package/dist/commonjs/component/lib.js +70 -564
- package/dist/commonjs/component/lib.js.map +1 -1
- package/dist/commonjs/component/logging.d.ts +6 -4
- package/dist/commonjs/component/logging.d.ts.map +1 -1
- package/dist/commonjs/component/logging.js +13 -2
- package/dist/commonjs/component/logging.js.map +1 -1
- package/dist/commonjs/component/loop.d.ts +26 -0
- package/dist/commonjs/component/loop.d.ts.map +1 -0
- package/dist/commonjs/component/loop.js +453 -0
- package/dist/commonjs/component/loop.js.map +1 -0
- package/dist/commonjs/component/recovery.d.ts +8 -0
- package/dist/commonjs/component/recovery.d.ts.map +1 -0
- package/dist/commonjs/component/recovery.js +74 -0
- package/dist/commonjs/component/recovery.js.map +1 -0
- package/dist/commonjs/component/schema.d.ts +163 -93
- package/dist/commonjs/component/schema.d.ts.map +1 -1
- package/dist/commonjs/component/schema.js +54 -65
- package/dist/commonjs/component/schema.js.map +1 -1
- package/dist/commonjs/component/shared.d.ts +130 -0
- package/dist/commonjs/component/shared.d.ts.map +1 -0
- package/dist/commonjs/component/shared.js +65 -0
- package/dist/commonjs/component/shared.js.map +1 -0
- package/dist/commonjs/component/stats.d.ts +3 -2
- package/dist/commonjs/component/stats.d.ts.map +1 -1
- package/dist/commonjs/component/stats.js +17 -3
- package/dist/commonjs/component/stats.js.map +1 -1
- package/dist/commonjs/component/worker.d.ts +25 -0
- package/dist/commonjs/component/worker.d.ts.map +1 -0
- package/dist/commonjs/component/worker.js +86 -0
- package/dist/commonjs/component/worker.js.map +1 -0
- package/dist/esm/client/index.d.ts +123 -35
- package/dist/esm/client/index.d.ts.map +1 -1
- package/dist/esm/client/index.js +122 -15
- package/dist/esm/client/index.js.map +1 -1
- package/dist/esm/client/utils.d.ts +16 -0
- package/dist/esm/client/utils.d.ts.map +1 -0
- package/dist/esm/client/utils.js +2 -0
- package/dist/esm/client/utils.js.map +1 -0
- package/dist/esm/component/convex.config.d.ts.map +1 -1
- package/dist/esm/component/convex.config.js +0 -2
- package/dist/esm/component/convex.config.js.map +1 -1
- package/dist/esm/component/kick.d.ts +9 -0
- package/dist/esm/component/kick.d.ts.map +1 -0
- package/dist/esm/component/kick.js +97 -0
- package/dist/esm/component/kick.js.map +1 -0
- package/dist/esm/component/lib.d.ts +23 -32
- package/dist/esm/component/lib.d.ts.map +1 -1
- package/dist/esm/component/lib.js +70 -564
- package/dist/esm/component/lib.js.map +1 -1
- package/dist/esm/component/logging.d.ts +6 -4
- package/dist/esm/component/logging.d.ts.map +1 -1
- package/dist/esm/component/logging.js +13 -2
- package/dist/esm/component/logging.js.map +1 -1
- package/dist/esm/component/loop.d.ts +26 -0
- package/dist/esm/component/loop.d.ts.map +1 -0
- package/dist/esm/component/loop.js +453 -0
- package/dist/esm/component/loop.js.map +1 -0
- package/dist/esm/component/recovery.d.ts +8 -0
- package/dist/esm/component/recovery.d.ts.map +1 -0
- package/dist/esm/component/recovery.js +74 -0
- package/dist/esm/component/recovery.js.map +1 -0
- package/dist/esm/component/schema.d.ts +163 -93
- package/dist/esm/component/schema.d.ts.map +1 -1
- package/dist/esm/component/schema.js +54 -65
- package/dist/esm/component/schema.js.map +1 -1
- package/dist/esm/component/shared.d.ts +130 -0
- package/dist/esm/component/shared.d.ts.map +1 -0
- package/dist/esm/component/shared.js +65 -0
- package/dist/esm/component/shared.js.map +1 -0
- package/dist/esm/component/stats.d.ts +3 -2
- package/dist/esm/component/stats.d.ts.map +1 -1
- package/dist/esm/component/stats.js +17 -3
- package/dist/esm/component/stats.js.map +1 -1
- package/dist/esm/component/worker.d.ts +25 -0
- package/dist/esm/component/worker.d.ts.map +1 -0
- package/dist/esm/component/worker.js +86 -0
- package/dist/esm/component/worker.js.map +1 -0
- package/package.json +6 -5
- package/src/client/index.ts +231 -70
- package/src/client/utils.ts +45 -0
- package/src/component/README.md +73 -0
- package/src/component/_generated/api.d.ts +36 -66
- package/src/component/convex.config.ts +0 -3
- package/src/component/kick.test.ts +286 -0
- package/src/component/kick.ts +118 -0
- package/src/component/lib.test.ts +203 -0
- package/src/component/lib.ts +80 -671
- package/src/component/logging.ts +24 -10
- package/src/component/loop.ts +579 -0
- package/src/component/recovery.ts +79 -0
- package/src/component/schema.ts +59 -77
- package/src/component/setup.test.ts +5 -0
- package/src/component/shared.ts +127 -0
- package/src/component/stats.ts +20 -6
- package/src/component/worker.ts +94 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Infer } from "convex/values";
|
|
2
|
+
import { Logger } from "./logging.js";
|
|
3
|
+
export declare const SECOND = 1000;
|
|
4
|
+
export declare const MINUTE: number;
|
|
5
|
+
export declare const HOUR: number;
|
|
6
|
+
export declare const DAY: number;
|
|
7
|
+
export declare const YEAR: number;
|
|
8
|
+
export declare function toSegment(ms: number): bigint;
|
|
9
|
+
export declare function currentSegment(): bigint;
|
|
10
|
+
export declare function nextSegment(): bigint;
|
|
11
|
+
export declare function fromSegment(segment: bigint): number;
|
|
12
|
+
export declare const config: import("convex/values").VObject<{
|
|
13
|
+
maxParallelism: number;
|
|
14
|
+
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
15
|
+
}, {
|
|
16
|
+
maxParallelism: import("convex/values").VFloat64<number, "required">;
|
|
17
|
+
logLevel: import("convex/values").VUnion<"DEBUG" | "INFO" | "WARN" | "ERROR", [import("convex/values").VLiteral<"DEBUG", "required">, import("convex/values").VLiteral<"INFO", "required">, import("convex/values").VLiteral<"WARN", "required">, import("convex/values").VLiteral<"ERROR", "required">], "required", never>;
|
|
18
|
+
}, "required", "maxParallelism" | "logLevel">;
|
|
19
|
+
export type Config = Infer<typeof config>;
|
|
20
|
+
export declare const retryBehavior: import("convex/values").VObject<{
|
|
21
|
+
maxAttempts: number;
|
|
22
|
+
initialBackoffMs: number;
|
|
23
|
+
base: number;
|
|
24
|
+
}, {
|
|
25
|
+
maxAttempts: import("convex/values").VFloat64<number, "required">;
|
|
26
|
+
initialBackoffMs: import("convex/values").VFloat64<number, "required">;
|
|
27
|
+
base: import("convex/values").VFloat64<number, "required">;
|
|
28
|
+
}, "required", "maxAttempts" | "initialBackoffMs" | "base">;
|
|
29
|
+
export type RetryBehavior = {
|
|
30
|
+
/**
|
|
31
|
+
* The maximum number of attempts to make. 2 means one retry.
|
|
32
|
+
*/
|
|
33
|
+
maxAttempts: number;
|
|
34
|
+
/**
|
|
35
|
+
* The initial backoff time in milliseconds. 100 means wait 100ms before the
|
|
36
|
+
* first retry.
|
|
37
|
+
*/
|
|
38
|
+
initialBackoffMs: number;
|
|
39
|
+
/**
|
|
40
|
+
* The base for the backoff. 2 means double the backoff each time.
|
|
41
|
+
* e.g. if the initial backoff is 100ms, and the base is 2, then the first
|
|
42
|
+
* retry will wait 200ms, the second will wait 400ms, etc.
|
|
43
|
+
*/
|
|
44
|
+
base: number;
|
|
45
|
+
};
|
|
46
|
+
export declare const runResult: import("convex/values").VUnion<{
|
|
47
|
+
kind: "success";
|
|
48
|
+
returnValue: any;
|
|
49
|
+
} | {
|
|
50
|
+
kind: "failed";
|
|
51
|
+
error: string;
|
|
52
|
+
} | {
|
|
53
|
+
kind: "canceled";
|
|
54
|
+
}, [import("convex/values").VObject<{
|
|
55
|
+
kind: "success";
|
|
56
|
+
returnValue: any;
|
|
57
|
+
}, {
|
|
58
|
+
kind: import("convex/values").VLiteral<"success", "required">;
|
|
59
|
+
returnValue: import("convex/values").VAny<any, "required", string>;
|
|
60
|
+
}, "required", "kind" | "returnValue" | `returnValue.${string}`>, import("convex/values").VObject<{
|
|
61
|
+
kind: "failed";
|
|
62
|
+
error: string;
|
|
63
|
+
}, {
|
|
64
|
+
kind: import("convex/values").VLiteral<"failed", "required">;
|
|
65
|
+
error: import("convex/values").VString<string, "required">;
|
|
66
|
+
}, "required", "kind" | "error">, import("convex/values").VObject<{
|
|
67
|
+
kind: "canceled";
|
|
68
|
+
}, {
|
|
69
|
+
kind: import("convex/values").VLiteral<"canceled", "required">;
|
|
70
|
+
}, "required", "kind">], "required", "kind" | "returnValue" | `returnValue.${string}` | "error">;
|
|
71
|
+
export type RunResult = Infer<typeof runResult>;
|
|
72
|
+
export declare const onComplete: import("convex/values").VObject<{
|
|
73
|
+
context?: any;
|
|
74
|
+
fnHandle: string;
|
|
75
|
+
}, {
|
|
76
|
+
fnHandle: import("convex/values").VString<string, "required">;
|
|
77
|
+
context: import("convex/values").VAny<any, "optional", string>;
|
|
78
|
+
}, "required", "fnHandle" | "context" | `context.${string}`>;
|
|
79
|
+
export type OnComplete = Infer<typeof onComplete>;
|
|
80
|
+
export type OnCompleteArgs = {
|
|
81
|
+
/**
|
|
82
|
+
* The ID of the work that completed.
|
|
83
|
+
*/
|
|
84
|
+
workId: string;
|
|
85
|
+
/**
|
|
86
|
+
* The context object passed when enqueuing the work.
|
|
87
|
+
* Useful for passing data from the enqueue site to the onComplete site.
|
|
88
|
+
*/
|
|
89
|
+
context: unknown;
|
|
90
|
+
/**
|
|
91
|
+
* The result of the run that completed.
|
|
92
|
+
*/
|
|
93
|
+
result: RunResult;
|
|
94
|
+
};
|
|
95
|
+
export declare const status: import("convex/values").VUnion<{
|
|
96
|
+
state: "pending";
|
|
97
|
+
attempt: number;
|
|
98
|
+
} | {
|
|
99
|
+
state: "running";
|
|
100
|
+
attempt: number;
|
|
101
|
+
} | {
|
|
102
|
+
state: "finished";
|
|
103
|
+
}, [import("convex/values").VUnion<{
|
|
104
|
+
state: "pending";
|
|
105
|
+
attempt: number;
|
|
106
|
+
} | {
|
|
107
|
+
state: "running";
|
|
108
|
+
attempt: number;
|
|
109
|
+
} | {
|
|
110
|
+
state: "finished";
|
|
111
|
+
}, [import("convex/values").VObject<{
|
|
112
|
+
state: "pending";
|
|
113
|
+
attempt: number;
|
|
114
|
+
}, {
|
|
115
|
+
state: import("convex/values").VLiteral<"pending", "required">;
|
|
116
|
+
attempt: import("convex/values").VFloat64<number, "required">;
|
|
117
|
+
}, "required", "state" | "attempt">, import("convex/values").VObject<{
|
|
118
|
+
state: "running";
|
|
119
|
+
attempt: number;
|
|
120
|
+
}, {
|
|
121
|
+
state: import("convex/values").VLiteral<"running", "required">;
|
|
122
|
+
attempt: import("convex/values").VFloat64<number, "required">;
|
|
123
|
+
}, "required", "state" | "attempt">, import("convex/values").VObject<{
|
|
124
|
+
state: "finished";
|
|
125
|
+
}, {
|
|
126
|
+
state: import("convex/values").VLiteral<"finished", "required">;
|
|
127
|
+
}, "required", "state">], "required", "state" | "attempt">], "required", "state" | "attempt">;
|
|
128
|
+
export type Status = Infer<typeof status>;
|
|
129
|
+
export declare function boundScheduledTime(ms: number, console: Logger): number;
|
|
130
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/component/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,OAAO,EAAE,MAAM,EAAY,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,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MAAM,CAAC,CAAC;AAE1C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAatE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { logLevel } from "./logging.js";
|
|
3
|
+
const SEGMENT_MS = 250;
|
|
4
|
+
export const SECOND = 1000;
|
|
5
|
+
export const MINUTE = 60 * SECOND;
|
|
6
|
+
export const HOUR = 60 * MINUTE;
|
|
7
|
+
export const DAY = 24 * HOUR;
|
|
8
|
+
export const YEAR = 365 * DAY;
|
|
9
|
+
export function toSegment(ms) {
|
|
10
|
+
return BigInt(Math.floor(ms / SEGMENT_MS));
|
|
11
|
+
}
|
|
12
|
+
export function currentSegment() {
|
|
13
|
+
return toSegment(Date.now());
|
|
14
|
+
}
|
|
15
|
+
export function nextSegment() {
|
|
16
|
+
return toSegment(Date.now()) + 1n;
|
|
17
|
+
}
|
|
18
|
+
export function fromSegment(segment) {
|
|
19
|
+
return Number(segment) * SEGMENT_MS;
|
|
20
|
+
}
|
|
21
|
+
export const config = v.object({
|
|
22
|
+
maxParallelism: v.number(),
|
|
23
|
+
logLevel,
|
|
24
|
+
});
|
|
25
|
+
export const retryBehavior = v.object({
|
|
26
|
+
maxAttempts: v.number(),
|
|
27
|
+
initialBackoffMs: v.number(),
|
|
28
|
+
base: v.number(),
|
|
29
|
+
});
|
|
30
|
+
// This ensures that the type satisfies the schema.
|
|
31
|
+
const _ = {};
|
|
32
|
+
export const runResult = v.union(v.object({
|
|
33
|
+
kind: v.literal("success"),
|
|
34
|
+
returnValue: v.any(),
|
|
35
|
+
}), v.object({
|
|
36
|
+
kind: v.literal("failed"),
|
|
37
|
+
error: v.string(),
|
|
38
|
+
}), v.object({
|
|
39
|
+
kind: v.literal("canceled"),
|
|
40
|
+
}));
|
|
41
|
+
export const onComplete = v.object({
|
|
42
|
+
fnHandle: v.string(),
|
|
43
|
+
context: v.optional(v.any()),
|
|
44
|
+
});
|
|
45
|
+
export const status = v.union(v.union(v.object({
|
|
46
|
+
state: v.literal("pending"),
|
|
47
|
+
attempt: v.number(),
|
|
48
|
+
}), v.object({
|
|
49
|
+
state: v.literal("running"),
|
|
50
|
+
attempt: v.number(),
|
|
51
|
+
}), v.object({
|
|
52
|
+
state: v.literal("finished"),
|
|
53
|
+
})));
|
|
54
|
+
export function boundScheduledTime(ms, console) {
|
|
55
|
+
if (ms < Date.now() - YEAR) {
|
|
56
|
+
console.warn("runAt is too far in the past, defaulting to now", ms);
|
|
57
|
+
return Date.now();
|
|
58
|
+
}
|
|
59
|
+
if (ms > Date.now() + 4 * YEAR) {
|
|
60
|
+
console.warn("runAt is too far in the future, defaulting to 1 year from now", ms);
|
|
61
|
+
return Date.now() + YEAR;
|
|
62
|
+
}
|
|
63
|
+
return ms;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +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,EAAU,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhD,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,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AAC7C,C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C,MAAM,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;CAC7B,CAAC,CAAC;AAmBH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,EACF,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,EACF,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;CAC7B,CAAC,CACH,CACF,CAAC;AAGF,MAAM,UAAU,kBAAkB,CAAC,EAAU,EAAE,OAAe;IAC5D,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE;QAC1B,OAAO,CAAC,IAAI,CAAC,iDAAiD,EAAE,EAAE,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;KACnB;IACD,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE;QAC9B,OAAO,CAAC,IAAI,CACV,+DAA+D,EAC/D,EAAE,CACH,CAAC;QACF,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;KAC1B;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -17,7 +17,8 @@ workpool
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function recordStarted(work: Doc<"work">): string;
|
|
20
|
-
export declare function recordCompleted(work: Doc<"work">, status: "success" | "
|
|
20
|
+
export declare function recordCompleted(work: Doc<"work">, status: "success" | "failed" | "canceled"): string;
|
|
21
|
+
export declare function recordReport(state: Doc<"internalState">): string;
|
|
21
22
|
/**
|
|
22
23
|
* Warning: this should not be used from a mutation, as it will cause conflicts.
|
|
23
24
|
* Use this to debug or diagnose your queue length when it's backed up.
|
|
@@ -29,7 +30,7 @@ export declare const queueLength: import("convex/server").RegisteredQuery<"inter
|
|
|
29
30
|
*/
|
|
30
31
|
export declare const debugCounts: import("convex/server").RegisteredQuery<"internal", {}, Promise<{
|
|
31
32
|
pendingStart: any;
|
|
32
|
-
inProgressWork:
|
|
33
|
+
inProgressWork: number;
|
|
33
34
|
pendingCompletion: any;
|
|
34
35
|
pendingCancelation: any;
|
|
35
36
|
active: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/component/stats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CASvD;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,MAAM,EAAE,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/component/stats.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGhD;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CASvD;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GACxC,MAAM,CASR;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,MAAM,CAahE;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,uEAOtB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;GAuBtB,CAAC"}
|
|
@@ -37,6 +37,20 @@ export function recordCompleted(work, status) {
|
|
|
37
37
|
lagSinceEnqueued: Date.now() - work._creationTime,
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
+
export function recordReport(state) {
|
|
41
|
+
const { completed, succeeded, failed, retries, canceled } = state.report;
|
|
42
|
+
const withoutRetries = completed - retries;
|
|
43
|
+
return JSON.stringify({
|
|
44
|
+
event: "report",
|
|
45
|
+
completed,
|
|
46
|
+
succeeded,
|
|
47
|
+
failed,
|
|
48
|
+
retries,
|
|
49
|
+
canceled,
|
|
50
|
+
failureRate: completed ? (failed + retries) / completed : 0,
|
|
51
|
+
permanentFailureRate: withoutRetries ? failed / withoutRetries : 0,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
40
54
|
/**
|
|
41
55
|
* Warning: this should not be used from a mutation, as it will cause conflicts.
|
|
42
56
|
* Use this to debug or diagnose your queue length when it's backed up.
|
|
@@ -57,19 +71,19 @@ export const debugCounts = internalQuery({
|
|
|
57
71
|
args: {},
|
|
58
72
|
returns: v.any(),
|
|
59
73
|
handler: async (ctx) => {
|
|
74
|
+
const inProgressWork = (await ctx.db.query("internalState").unique())?.running.length ?? 0;
|
|
60
75
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
61
|
-
const inProgressWork = await ctx.db.query("inProgressWork").count();
|
|
62
76
|
const pendingStart = await ctx.db.query("pendingStart").count();
|
|
63
77
|
const pendingCompletion = await ctx.db.query("pendingCompletion").count();
|
|
64
78
|
const pendingCancelation = await ctx.db.query("pendingCancelation").count();
|
|
79
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
65
80
|
return {
|
|
66
81
|
pendingStart,
|
|
67
82
|
inProgressWork,
|
|
68
83
|
pendingCompletion,
|
|
69
84
|
pendingCancelation,
|
|
70
|
-
active: inProgressWork - pendingCompletion
|
|
85
|
+
active: inProgressWork - pendingCompletion,
|
|
71
86
|
};
|
|
72
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
73
87
|
},
|
|
74
88
|
});
|
|
75
89
|
//# sourceMappingURL=stats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/component/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,MAAM,EAAE,IAAI,CAAC,GAAG;QAChB,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,aAAa;QAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,gBAAgB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa;KAClD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,IAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/component/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,MAAM,EAAE,IAAI,CAAC,GAAG;QAChB,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,C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AC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAS,CAAC,KAAK,EAAE,CAAC;IACvD,CAAC;CACF,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE;IAChB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,cAAc,GAClB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;QACtE,uDAAuD;QACvD,MAAM,YAAY,GAAG,MAAO,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAS,CAAC,KAAK,EAAE,CAAC;QACzE,MAAM,iBAAiB,GAAG,MACxB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,mBAAmB,CACjC,CAAC,KAAK,EAAE,CAAC;QACV,MAAM,kBAAkB,GAAG,MACzB,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAClC,CAAC,KAAK,EAAE,CAAC;QACV,sDAAsD;QACtD,OAAO;YACL,YAAY;YACZ,cAAc;YACd,iBAAiB;YACjB,kBAAkB;YAClB,MAAM,EAAE,cAAc,GAAG,iBAAiB;SAC3C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const runMutationWrapper: import("convex/server").RegisteredMutation<"internal", {
|
|
2
|
+
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
3
|
+
fnHandle: string;
|
|
4
|
+
workId: import("convex/values").GenericId<"work">;
|
|
5
|
+
fnArgs: any;
|
|
6
|
+
}, Promise<void>>;
|
|
7
|
+
export declare const runActionWrapper: import("convex/server").RegisteredAction<"internal", {
|
|
8
|
+
logLevel: "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
9
|
+
fnHandle: string;
|
|
10
|
+
workId: import("convex/values").GenericId<"work">;
|
|
11
|
+
fnArgs: any;
|
|
12
|
+
}, Promise<void>>;
|
|
13
|
+
export declare const saveResult: import("convex/server").RegisteredMutation<"internal", {
|
|
14
|
+
workId: import("convex/values").GenericId<"work">;
|
|
15
|
+
runResult: {
|
|
16
|
+
kind: "success";
|
|
17
|
+
returnValue: any;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "failed";
|
|
20
|
+
error: string;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "canceled";
|
|
23
|
+
};
|
|
24
|
+
}, Promise<void>>;
|
|
25
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/component/worker.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,kBAAkB;;;;;iBA0B7B,CAAC;AASH,eAAO,MAAM,gBAAgB;;;;;iBA2B3B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;iBAarB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { internal } from "./_generated/api.js";
|
|
3
|
+
import { internalAction, internalMutation } from "./_generated/server.js";
|
|
4
|
+
import { kickMainLoop } from "./kick.js";
|
|
5
|
+
import { createLogger, logLevel } from "./logging.js";
|
|
6
|
+
import { nextSegment, runResult } from "./shared.js";
|
|
7
|
+
export const runMutationWrapper = internalMutation({
|
|
8
|
+
args: {
|
|
9
|
+
workId: v.id("work"),
|
|
10
|
+
fnHandle: v.string(),
|
|
11
|
+
fnArgs: v.any(),
|
|
12
|
+
logLevel,
|
|
13
|
+
},
|
|
14
|
+
handler: async (ctx, { workId, fnHandle: handleStr, fnArgs, logLevel }) => {
|
|
15
|
+
const console = createLogger(logLevel);
|
|
16
|
+
const fnHandle = handleStr;
|
|
17
|
+
try {
|
|
18
|
+
const returnValue = await ctx.runMutation(fnHandle, fnArgs);
|
|
19
|
+
// NOTE: we could run the `saveResult` handler here, or call `ctx.runMutation`,
|
|
20
|
+
// but we want the mutation to be a separate transaction to reduce the window for OCCs.
|
|
21
|
+
await ctx.scheduler.runAfter(0, internal.worker.saveResult, {
|
|
22
|
+
workId,
|
|
23
|
+
runResult: { kind: "success", returnValue },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.error(e);
|
|
28
|
+
await ctx.scheduler.runAfter(0, internal.worker.saveResult, {
|
|
29
|
+
workId,
|
|
30
|
+
runResult: { kind: "failed", error: formatError(e) },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
function formatError(e) {
|
|
36
|
+
if (e instanceof Error) {
|
|
37
|
+
return e.message;
|
|
38
|
+
}
|
|
39
|
+
return String(e);
|
|
40
|
+
}
|
|
41
|
+
export const runActionWrapper = internalAction({
|
|
42
|
+
args: {
|
|
43
|
+
workId: v.id("work"),
|
|
44
|
+
fnHandle: v.string(),
|
|
45
|
+
fnArgs: v.any(),
|
|
46
|
+
logLevel,
|
|
47
|
+
},
|
|
48
|
+
handler: async (ctx, { workId, fnHandle: handleStr, fnArgs, logLevel }) => {
|
|
49
|
+
const console = createLogger(logLevel);
|
|
50
|
+
const fnHandle = handleStr;
|
|
51
|
+
try {
|
|
52
|
+
const returnValue = await ctx.runAction(fnHandle, fnArgs);
|
|
53
|
+
// NOTE: we could run `ctx.runMutation`, but we want to guarantee execution,
|
|
54
|
+
// and `ctx.scheduler.runAfter` won't OCC.
|
|
55
|
+
await ctx.scheduler.runAfter(0, internal.worker.saveResult, {
|
|
56
|
+
workId,
|
|
57
|
+
runResult: { kind: "success", returnValue },
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
console.error(e);
|
|
62
|
+
// We let the main loop handle the retries.
|
|
63
|
+
await ctx.scheduler.runAfter(0, internal.worker.saveResult, {
|
|
64
|
+
workId,
|
|
65
|
+
runResult: { kind: "failed", error: formatError(e) },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
export const saveResult = internalMutation({
|
|
71
|
+
args: {
|
|
72
|
+
workId: v.id("work"),
|
|
73
|
+
runResult,
|
|
74
|
+
},
|
|
75
|
+
handler: async (ctx, { workId, runResult }) => {
|
|
76
|
+
await ctx.db.insert("pendingCompletion", {
|
|
77
|
+
runResult,
|
|
78
|
+
workId,
|
|
79
|
+
segment: nextSegment(),
|
|
80
|
+
});
|
|
81
|
+
await kickMainLoop(ctx, "saveResult");
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
+
const console = "THIS IS A REMINDER TO USE createLogger";
|
|
86
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/component/worker.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;IACjD,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE;QACf,QAAQ;K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AO,EAAE,WAAW,EAAE;SACvB,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACxC,CAAC;CACF,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,OAAO,GAAG,wCAAwC,CAAC"}
|
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.2.0-beta.0",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"convex",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepare": "npm run build",
|
|
28
28
|
"prepack": "node node10stubs.mjs",
|
|
29
29
|
"postpack": "node node10stubs.mjs --cleanup",
|
|
30
|
-
"test": "vitest
|
|
30
|
+
"test": "vitest",
|
|
31
31
|
"lint": "tsc --noEmit && eslint . && prettier --check .",
|
|
32
32
|
"format": "prettier --write .",
|
|
33
33
|
"test:debug": "vitest --inspect-brk --no-file-parallelism",
|
|
@@ -66,18 +66,19 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint/js": "^9.9.1",
|
|
68
68
|
"@types/node": "^18.17.0",
|
|
69
|
-
"convex-test": "^0.0.
|
|
69
|
+
"convex-test": "^0.0.36-alpha.0",
|
|
70
70
|
"eslint": "^9.9.1",
|
|
71
71
|
"globals": "^15.9.0",
|
|
72
72
|
"prettier": "3.2.5",
|
|
73
73
|
"typescript": "~5.0.3",
|
|
74
74
|
"typescript-eslint": "^8.4.0",
|
|
75
|
-
"vitest": "^2.1.
|
|
75
|
+
"vitest": "^2.1.9"
|
|
76
76
|
},
|
|
77
77
|
"main": "./dist/commonjs/client/index.js",
|
|
78
78
|
"types": "./dist/commonjs/client/index.d.ts",
|
|
79
79
|
"module": "./dist/esm/client/index.js",
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@
|
|
81
|
+
"@edge-runtime/vm": "^4.0.4",
|
|
82
|
+
"@vitest/coverage-v8": "^2.1.9"
|
|
82
83
|
}
|
|
83
84
|
}
|