Queue State Changes in NodeRed

I have a flow which tracks state changes on multiple entities (it’s actually update entities, but not entirely relevant)

If it detects that there is a change to one of these, it takes actions… but I’m not entirely sure what happens if I get multiple changes before the flow has completed (e.g. multiple differing updates in a short period)

Is there any way to queue these up? Or do I need to duplicate my flow for each of these?

@vaderag Here is one possibility

It depends on what you want to happen. If you’re happy that the flow will rerun “in parallel”, then you don’t need to do anything. Each node blocks, so it’s not really parallel, but hopefully you get what I mean.

Each run of the flow will have it’s own “msg” object, so they will not interfere with each other. However, if you’re also using flow/global context (for example), you may have to account for this.

Oh okay - so sounds like I might be safe anyway

My concern was the 3 minute wait - I have no way of actually confirming that the update is successful, so concern was that during that 3mins there might be another update and then kick things off from scratch.

But sounds like what you’re saying is in that context there will be a “second” flow running in parallel which would have it’s own 3min delay?

Yes, each run of the flow will have it’s own 3 minute delay, even if they overlap. You can see this if you hook up an inject to a delay to a debug. If you then hit the inject quickly you will see the status under the delay count the number of current delays waiting. Then after each delay ends you’ll see the debug result.

1 Like