How to Rerun Workflows After a Timeout Without Increasing the Time Limit?

This topic was automatically generated from Slack. You can find the original thread here.

Pls what’s the way to get workflows to rerun if they encounter a time out message?

(Apart from increasing the time limit)

can you show me how to enable automatic reruns via the workflow settings? As well as how to use $.flow.retry in Node.js code?

To enable automatic reruns via the workflow settings, you’ll need to navigate to the workflow settings in the Pipedream UI. Unfortunately, as of my last update, detailed steps for enabling automatic reruns through the UI settings were not provided in the documentation I have access to. For the most up-to-date instructions, please visit the Pipedream documentation or support. Regarding using $.flow.retry in Node.js code, it seems there might be a slight misunderstanding in the function name. Based on the Pipedream documentation, the correct function for rerunning a step or workflow programmatically is $.flow.rerun, not $.flow.retry. Here’s how you can use $.flow.rerun within a Node.js code step: async run({steps, $}) { try { // Your code here. For example, making an HTTP request } catch (error) { // If an error occurs, you can rerun the current step // You can specify the number of milliseconds to wait before rerunning the step // For example, to wait 5 seconds before rerunning: $.flow.rerun(5000); } } This example demonstrates how to catch an error in a try…catch block and use $.flow.rerun to rerun the current step after a specified delay. This can be particularly useful for retrying failed API requests or other operations that might succeed upon a subsequent attempt. For more detailed examples and use cases, please refer to the Pipedream documentation on rerunning a Node.js code step with $.flow.rerun and automatically retrying an HTTP request.

$.flow.retry? Interesting

When did this come out

Sorry, typo. $.flow.rerun is what I meant to say:

oh… lol

I use this as well

But i dont think it will run on a time out error. That seems to crash the whole app.

Or is there a way to catch it?

I’m talking about the WF environment time. out error

Like when a WF goes over the set time limit

Increasing the time limit is not the answer here cos the time error is sporadic… On rerunning, the WF executes in way shorter time than allocated

So rerunning is a better answer than increasing the time limit

These time outs could be time spent waiting for async operations to complete like API calls, etc.

You might need to split the workflow into separate parts so that you’re not hitting the timeout limit, and separate out the longer running operations first.

I’ve broken the WF down to single calls… Slow to respond API calls are inevitable, one can only figure out a way to retry when it happens.

I get a this notification from the errors channel. Just want to know how I can kick off a rerun from this…

image.png

You could just trigger the workflow again maybe?

Using an HTTP trigger?

But I don’t remember if $errors provides access to the original triggering event. :thinking_face: (in order to re-send it)

Hmm… I’ll need the initial body to re-trigger…

Yes, it does! :raised_hands:

image.png

Or rather to work with