Skip to content

Commit 60021d7

Browse files
committed
Expose static Netlify workflow sweep schedule
1 parent bb5d0ac commit 60021d7

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

docs/internal/workflow-intent-sync.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ Netlify does not run a long-lived worker. It only wakes the runtime.
4343

4444
```ts
4545
export default createNetlifyWorkflowSweepHandler({ runtime: workflowRuntime })
46-
export const config = createNetlifyWorkflowSweepConfig({
46+
47+
export const config: Config = {
4748
schedule: '*/5 * * * *',
48-
})
49+
}
4950
```
5051

5152
Each sweep materializes due schedule buckets and starts deterministic workflow
@@ -63,6 +64,10 @@ Examples:
6364
The scheduled function is deliberately stateless. If it is delivered late or
6465
twice, the runtime/store should claim each bucket once.
6566

67+
The schedule is intentionally exported as a static `Config` object, matching the
68+
other scheduled functions in this repo. Netlify's deploy-time scheduled function
69+
scanner must be able to see the cron string without evaluating adapter helpers.
70+
6671
## Durable Store
6772

6873
Workflow persistence is generic and shared by every workflow in the app. The
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
import {
2-
createNetlifyWorkflowSweepConfig,
3-
createNetlifyWorkflowSweepHandler,
4-
} from '@tanstack/workflow-netlify'
5-
import {
6-
workflowRuntime,
7-
WORKFLOW_RUNTIME_SWEEP_CRON,
8-
} from '~/utils/workflow-runtime.server'
1+
import type { Config } from '@netlify/functions'
2+
import { createNetlifyWorkflowSweepHandler } from '@tanstack/workflow-netlify'
3+
import { workflowRuntime } from '~/utils/workflow-runtime.server'
94

105
export default createNetlifyWorkflowSweepHandler({
116
runtime: workflowRuntime,
@@ -14,6 +9,6 @@ export default createNetlifyWorkflowSweepHandler({
149
maxTimers: 10,
1510
})
1611

17-
export const config = createNetlifyWorkflowSweepConfig({
18-
schedule: WORKFLOW_RUNTIME_SWEEP_CRON,
19-
})
12+
export const config: Config = {
13+
schedule: '*/5 * * * *',
14+
}

src/utils/workflow-runtime.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import { createDrizzlePostgresWorkflowStore } from '@tanstack/workflow-store-dri
77
import { db } from '~/db/client'
88
import { createAppWorkflowRegistrations } from '~/utils/workflow-registrations.server'
99

10-
export const WORKFLOW_RUNTIME_SWEEP_CRON = '*/5 * * * *'
11-
1210
export const workflowExecutionStore = createDrizzlePostgresWorkflowStore({ db })
1311

1412
export function createAppWorkflowRuntime(options?: {

0 commit comments

Comments
 (0)