Wait node in workflow [GOT CREATED]

I think some flows need wait node.
For example if after some minutes doesn’t occur any(or special) event execute another flow or some specific nodes.

Totally agree! A wait-node would be very important for many use cases. Implementing that properly is sadly not trivial and would take some time. For a short wait time (a few seconds) it would be OK (and best) to simply leave the process running.

That can also be done with a Function-Node already like this:

For everything longer, it gets more complicated. Then it should save the data of the current workflow to the database, set up some kind of timer in the main process (which also has to handle when the main process gets restarted or is turned off for a longer time) and once the timer fires it has to load the data again from the database and then start the workflow from where it left off.

Because if somebody would, for example, automate some kind of signup flow where it first directly sends a welcome email and then another one a week later it would cause big problems. If such a wait is not implemented correctly there would be a lot of waiting processes that would over time eat up all the RAM and at some point crash the system.

It is definitely nothing impossible but sadly something which has to be thought about properly and done correctly.

3 Likes

I think little you tell more.
You are the best my friend.

Thanks a lot!

Hope I will be able to create a proper solution for that soon!

1 Like

Thank you.
I will so.

This is a good thing for me as well. I think a easy way to implement this is to have something in memory or in some storage like:

  • Run task
  • Stop task as status WAITING
  • throw in memory that a task exist and it’s in waiting
  • Check storage to see if there is anything in the queue
  • If there is, run
  • If there is not, wait for the “checker” to be called again
  • fun checker every 30s or so and to that as the smallest timeframe (You can configure the timeframe as well)
  • If it checked more than 5 times (configurable in the screen), just say it didn’t work

I don’t know if something like this is possible, but that’s how i did something like that for a client once

3 Likes

This can be a good solution for a trigger that i want. Everytime a new line is introduced to google sheets, call the task. Today i will do that in lambda e call n8n via webhook. But this loop thing can be a good way to implement the new line in Google sheets.

How did you add the trigger for google sheet when a new row is inserted in google sheets.

What do you mean exactly? How you would program one or how to do it currently? Because no such functionality exists yet.

I meant to say that , i want to listen for google sheet insertion event . Is there any way to do that ?

No currently no such trigger exists yet.

So how can i program it manually , do i need to write a custom backend service(that will be an webhook api) so that i can use that as a webhook trigger ?

Did not have time yet to try if it works but I think that one could work:

I had planned to use that one for a Trigger-Node if it does, at least as soon I find some time. For you to test, you can simply create a Webhook-Node, get its URL, and then add it as watch to Google manually. The workflow should then normally execute whenever you make a change.

It would be great if you could inform me if you tried it and if it worked.

I don’t know why recently it doesn’t work.
Could we have something like timer (waiting for some minute) node probably?

Best regards.

Sorry, I do not understand. What does not work exactly anymore?

No matter how the node is called, if timer or wait. It would sadly have exactly the same implications.

This is my error:

ERROR: No data got returned. Always return an Array of items!

```
Error: No data got returned. Always return an Array of items!
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Function.node.js:70:19)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:370:47
```

Ah, you can fix it by simply making sure that items get returned. So this one will work fine:

This is exactly the same as above, isn’t it? I got
ERROR: No data got returned. Always return an Array of items!

No it is different as it returns the items and for that reason works fine.

1 Like

My bad, works perfectly fine now :+1:

1 Like