Problem with having multiple messages/events at the same time

Hello everyone, everything good?

I'm developing some flows on node-red and I came across a problem. When I receive just one event/message in my flows, it works great, however, when I receive several events/messages at the same time, the flows don't work correctly.

So I added a delay node so that the flows can organize themselves. This node accumulates the messages and returns them one by one in a certain time interval.

I believe this is not the best way to solve the problem, would there be something more efficient like a 'FIFO' or semaphore?

Hi kaiossoares.

  1. Are you using context variables, if so they can cause race conditions.
    Try to create the flow saving vars in the message. or save context using message id as part of var nam, then you can retrieve further on and delete once finished.

  2. There is a semaphore node in the flow library, and others

  3. You can use the delay node in rate limit, set with a long time to rate. once flow has finished you can feed back with msg.flush = 1 to release the next message. there are several examples on the forum.

If you posted a flow showing you issue we would have a better understanding.
How to import/export a flow

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

1 Like

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