Skip to content
Source
Sign inSign up
TanStack/workflow

Harden runtime lease recovery and event publishing #15

Mergedtannerlinsleymerged 1 commit intomain fromtaren/runtime-lease-recoverymerged by tannerlinsley

Showing 10 changed files with 62 additions and 12 deletions (loading 7).

x
0 of 10 viewed, 10 left
7 additions and 0 deletions.changeset/bright-runs-recover.mdAdded
View file
@@ -0,0 +1,7 @@
+---
+'@tanstack/workflow-core': patch
+'@tanstack/workflow-runtime': patch
+---
+​
+Add expired-run recovery, automatic run-lease heartbeats, and best-effort live
+event publishing to the workflow runtime.
31 additions and 3 deletionsdocs/api/runtime.mdModified
View file
@@ -18,6 +18,9 @@
const runtime = defineWorkflowRuntime({
store,
defaultLeaseMs: 30_000,
+ publish: async (runId, event) => {
+ await eventBus.publish(runId, event)
+ },
telemetry: {
spanNamePrefix: 'tanstack.workflow',
},
@@ -98,6 +101,26 @@
​
Step timeouts remain per-attempt limits and do not use the runtime deadline.
​
+## Leases and recovery
+​
+The runtime renews an owned run lease every third of `leaseMs` while workflow
+code is running. It stops renewal before releasing the lease on completion,
+pause, yield, or error. `leaseMs` must be a positive finite number.