Function execution time

Hi,
at start of my home automation project, I read a text file to load the default values of my system.
These are 80 and more variables that I update,
are subdivided into groups and I have a delay node before each group.

Well, the questions .......

  1. are the delay necessary?
  2. if YES, how much should be long? (seconds, milliseconds)

And in general, if I have more function to execute, is recommended to insert a delay node before each function?

Looking at that screenshot, I see zero reasons to have the delay nodes. Why do you feel they are necessary?

Because a few months ago I saw a video of node-red programming and before the function, the programmer had inserted delay nodes (millisecond) to prevent too much code executed to the same time.

If you were calling external APIs or calling to database at high speed you might want a delay node (or more likely a delay node set to rate limit mode) but in your case I see no reason.

Ok, thank you ...

In general that will not happen, NR is singel-threaded, but there could be some more situations besides those mentioned by @Steve-Mcl where a delay might be justified (and needed) or a flow re-design is necessary

As example, suppose you have no delay nodes and are setting a flow or global context variable in the "temp limite min" function node and then use that variable in some condition in the "gruppo 29-38" function. In such case it could (it will) happen that the variable is still undefined when the code is executing in "gruppo 29-38". But this all depends what you have inside your flow and if you define such variables in the flow or global context or not (based in own experience that happened to myself)

1 Like

Ok, this is not my case but I understand logic .....

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.