@rivetkit/workflow-engine 0.0.0-05-09-fix-workflow-engine-only-commit-step-state-after-success.0668fa7 → 0.0.0-05-12-do-not-merge-queue-diagnose.f7733df
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/dist/tsup/{chunk-ODIFRE72.js → chunk-NMNQBKTZ.js} +12 -2
- package/dist/tsup/chunk-NMNQBKTZ.js.map +1 -0
- package/dist/tsup/{chunk-AS7T5GPL.cjs → chunk-VAXP4ILI.cjs} +12 -2
- package/dist/tsup/chunk-VAXP4ILI.cjs.map +1 -0
- package/dist/tsup/index.cjs +2 -2
- package/dist/tsup/index.js +1 -1
- package/dist/tsup/testing.cjs +23 -23
- package/dist/tsup/testing.js +1 -1
- package/package.json +1 -1
- package/src/context.ts +12 -4
- package/dist/tsup/chunk-AS7T5GPL.cjs.map +0 -1
- package/dist/tsup/chunk-ODIFRE72.js.map +0 -1
|
@@ -2201,7 +2201,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2201
2201
|
}
|
|
2202
2202
|
const maxRetries2 = config2.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
2203
2203
|
if (metadata2.attempts > maxRetries2) {
|
|
2204
|
-
const lastError =
|
|
2204
|
+
const lastError = metadata2.error;
|
|
2205
2205
|
const exhaustedError = new StepExhaustedError(
|
|
2206
2206
|
config2.name,
|
|
2207
2207
|
lastError
|
|
@@ -2290,6 +2290,10 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2290
2290
|
});
|
|
2291
2291
|
return output;
|
|
2292
2292
|
} catch (error) {
|
|
2293
|
+
if (entry.kind.type === "step") {
|
|
2294
|
+
entry.kind.data.error = String(error);
|
|
2295
|
+
}
|
|
2296
|
+
entry.dirty = true;
|
|
2293
2297
|
if (error instanceof StepTimeoutError) {
|
|
2294
2298
|
metadata.status = "exhausted";
|
|
2295
2299
|
metadata.error = String(error);
|
|
@@ -2822,6 +2826,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2822
2826
|
}
|
|
2823
2827
|
if (existingCount && existingCount.kind.type === "message") {
|
|
2824
2828
|
const replayCount = existingCount.kind.data.data;
|
|
2829
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: replaying from history", name, replayCount, completable });
|
|
2825
2830
|
return await this.readReplayQueueMessages(
|
|
2826
2831
|
name,
|
|
2827
2832
|
replayCount,
|
|
@@ -2830,6 +2835,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2830
2835
|
}
|
|
2831
2836
|
const now = Date.now();
|
|
2832
2837
|
if (deadline !== void 0 && now >= deadline) {
|
|
2838
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: deadline already passed", name, deadline, now });
|
|
2833
2839
|
if (deadlineEntry && deadlineEntry.kind.type === "sleep") {
|
|
2834
2840
|
deadlineEntry.kind.data.state = "completed";
|
|
2835
2841
|
deadlineEntry.dirty = true;
|
|
@@ -2841,11 +2847,13 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2841
2847
|
);
|
|
2842
2848
|
return [];
|
|
2843
2849
|
}
|
|
2850
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: calling receiveMessagesNow", name, messageNames, count, completable });
|
|
2844
2851
|
const received = await this.receiveMessagesNow(
|
|
2845
2852
|
messageNames,
|
|
2846
2853
|
count,
|
|
2847
2854
|
completable
|
|
2848
2855
|
);
|
|
2856
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: receiveMessagesNow returned", name, receivedCount: received.length, receivedNames: received.map((m) => m.name) });
|
|
2849
2857
|
if (received.length > 0) {
|
|
2850
2858
|
const historyMessages = received.map(
|
|
2851
2859
|
(message) => this.toWorkflowQueueMessage(message)
|
|
@@ -2872,8 +2880,10 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
|
|
|
2872
2880
|
return queueMessages;
|
|
2873
2881
|
}
|
|
2874
2882
|
if (deadline === void 0) {
|
|
2883
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: no messages and no deadline, throwing MessageWaitError", name, messageNames });
|
|
2875
2884
|
throw new MessageWaitError(messageNames);
|
|
2876
2885
|
}
|
|
2886
|
+
this.log("debug", { msg: "DEBUG_QUEUE executeQueueNextBatch: no messages, throwing SleepError", name, messageNames, deadline });
|
|
2877
2887
|
throw new SleepError(deadline, messageNames);
|
|
2878
2888
|
}
|
|
2879
2889
|
normalizeQueueNames(names) {
|
|
@@ -4195,4 +4205,4 @@ export {
|
|
|
4195
4205
|
runWorkflow,
|
|
4196
4206
|
replayWorkflowFromStep
|
|
4197
4207
|
};
|
|
4198
|
-
//# sourceMappingURL=chunk-
|
|
4208
|
+
//# sourceMappingURL=chunk-NMNQBKTZ.js.map
|