Skip to content
Discussion options

You must be logged in to vote

We do want to have native cron support in workflow. I'll write an RFC for it shortly. In the meantime, you can either

  1. Use vercel cron to spin a route that does await start(yourWorkflow)
  2. Write your cron inside a workflow and just start the workflow once. See examples below:
function cronWorkflow() {
  "use workflow";
  
  while (true) {
    await sleep("1 day"); // or whatever
    someStep(); // you can await if you want, but don't have to. This can "run in the background"
  }
}

function someStep() {
  "use workflow";

  // do things...
}

Note: I'm calling a workflow inside a workflow. This works but doesn't actually do anything today (it's treated as a normal function in the workflow) …

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@abrunner94
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@reasv
Comment options

@reasv
Comment options

@pranaygp
Comment options

@reasv
Comment options

@davidchalifoux
Comment options

Answer selected by pranaygp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants