-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Simple workflow with Selective Retry which should probably work differently - #23 :
const fetchOnChainWorkflow = Workflow.make((taskId: string) =>
Effect.gen(function* () {
const workflowCtx = yield* WorkflowContext;
yield* Effect.log(`Processing workflow ${workflowCtx.workflowName}, with id ${workflowCtx.workflowId}`);
const mvrv = yield* Workflow.step("MVRV",
fetchMVRVIdempotent(taskId)
.pipe(
Effect.catchTag("FetchError", (error) =>
Effect.fail(
new MVRVFailed({ reason: `Status Code: ${error.status}`, taskId: taskId }))
),
Workflow.retry({
maxAttempts: 3,
delay: "2 seconds",
})
));
yield* Workflow.step("NUPL",
fetchNUPLIdempotent(taskId).pipe(
Effect.catchTag("FetchError", (error) =>
Effect.fail(
new NUPLFailed({ reason: `Status Code: ${error.status}`, taskId: taskId }))
)
)
);
yield* Workflow.step("Hash Ribbons",
fetchHashRibbonsIdempotent(taskId).pipe(
Effect.catchTag("FetchError", (error) =>
Effect.fail(
new HashRibbonsFailed({ reason: `Status Code: ${error.status}`, taskId: taskId }))
)
)
);
yield* workflowCtx.setMeta("completed", Date.now());
})
.pipe(
Effect.catchAll((error) =>
Effect.gen(function* () {
const ctx = yield* WorkflowContext;
yield* ctx.setMeta("error", String(error));
yield* Effect.logError("Workflow failed", error);
})
)),
);after adding:
.pipe(
Effect.catchAll((error) =>
Effect.gen(function* () {
const ctx = yield* WorkflowContext;
yield* ctx.setMeta("error", String(error));
yield* Effect.logError("Workflow failed", error);
})
)),getting in console:
[wrangler:info] GET /workflows/sentiment/onchain 200 OK (59ms)
timestamp=2025-12-10T18:34:48.836Z level=INFO fiber=#48 message="Processing workflow {
\"_id\": \"Effect\",
\"_op\": \"OnSuccess\",
\"effect_instruction_i0\": {
\"_id\": \"Effect\",
\"_op\": \"OnFailure\",
\"effect_instruction_i0\": {
\"_id\": \"Effect\",
\"_op\": \"OnSuccess\",
\"effect_instruction_i0\": {
\"_id\": \"Effect\",
\"_op\": \"OnSuccess\",
\"effect_instruction_i0\": {
\"_id\": \"Effect\",
\"_op\": \"Sync\"
}
}
}
}
}, with id {
\"_id\": \"Exit\",
\"_tag\": \"Success\",
\"value\": \"df13a21a3c6e42fd19799ec74b9bd5c2b26d7ec7159721ef7708b440301c0796\"
}"
timestamp=2025-12-10T18:34:48.837Z level=INFO fiber=#48 message="Fetching data for step MVRV"
timestamp=2025-12-10T18:34:49.059Z level=INFO fiber=#48 message="Response: 429, false"
timestamp=2025-12-10T18:34:49.066Z level=ERROR fiber=#48 message="Workflow failed" message="{
\"reason\": \"retry\",
\"resumeAt\": 1765391690684.5813,
\"stepName\": \"MVRV\",
\"attempt\": 2,
\"_tag\": \"PauseSignal\"
}"
Whole code available here
Metadata
Metadata
Assignees
Labels
No labels