Workflow Steps Don't Run After Sleep
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 365
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 169
Description
I have a workflow that sleeps and on random occasions, the workflow does not resume. The sleep duration usually ranges from 50 - 9000ms. When I rounded to the nearest second, it seems to reduce the issue but it occured at around 30 minutes mark of my workflow. In Vercel logs, there is a timeout log observed everytime the error occurs
async function sleepIfRequired(startTime: number, delayMs: number) {
// BUG: Rounded to the nearest thousand seem to not lead to any issues
const timeTaken = Date.now() - startTime;
const sleepTime = Math.ceil((delayMs - timeTaken) / 1000) * 1000;
if (sleepTime >= 1000) {
await sleep(sleepTime);
}
}
I am using: "workflow": "4.0.1-beta.32"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sleepIfRequired function shown in the issue and inspect how workflow 4.0.1-beta.32 schedules delays and handles Vercel timeouts. Reproduce the failure with non-second-aligned delays, then verify that workflows resume reliably after sleep.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100