Hi, is it possible to set the retry steps *after* a workflow fails? For example one of my workflow s

Hi, is it possible to set the retry steps after a workflow fails? For example one of my workflow steps calls a third party api where I don't know the ratelimits. I want to fail the step if I'm ratelimited, but then retry at a specific date (the api gives us this date if we're ratelimited).

I can think of some ideas like

for (const param of params) {
  while (true) {
    const response = await step.do('<random name>', { /* options to not retry */ }, ...)

    if (response.status === 429) {
      await step.sleep('ratelimit expires', Number(response.headers.get('X-RateLimit-Reset')) * 1000)
    } else {
      break
    }
  }
}


but I'm wondering if there's anything better?
Was this page helpful?