Delay / rate limit drops final message?

I've been using Node Red for the first time over past week, and I'm LOVING it! But I've struck an issue with the Delay node, which I might be misunderstanding...

My flow takes input from a hardware rotary dimmer, calculates some brightness values for a lighting setup, then sends the updated brightness values to a WLED controller. The rotary input generates a huge number of messages per second, and I'm using the delay node to rate limit down to 2 messages a second with "Drop intermediate messages" active, so as not to overload the controller

What I'm finding is that "Drop intermediate messages" will also drop the final message that comes in, if the node is mid-way through delay when that final message arrives. Am I understanding this correctly?

Is there a clean and simple way to ensure that the Delay node always sends the final message it receives? Or, to trigger one more message once the Delay queue is empty?

Try a trigger node...


In case you didn't realise, I think Paul intended that you wire the trigger node in parallel with the delay node so that it it passes the last message on after the message stream stops. I think maybe the delay should be 500ms, though it probably doesn't matter.

Brilliant! Exactly what I need. Thanks @Paul-Reed and @Colin for the help.

The trigger node will send the last received message 250ms after the last message stream stops.
No need for a delay node at all, unless I've misread.

The 250ms can be fine tuned so that it avoids repetition, but doesn't cause a noticeable delay.

The trigger node only send the last one, the requirement is (I believe) to rate limit but ensure the last one gets through.

I read it that OP just wanted the last message, because the rotary dimmer spits out lots of msg's until it arrives at it's final destination, similar to the old problems encountered by the ui_slider node.
I'm sure Peter will let us know if it doesn't match his expectations.

I need the crowded stream of messages to be trimmed to around 2 per second, whilst ensuring the very last one isn't discarded. It seems a Delay node + Trigger node in parallel solves the issue. :slight_smile:

1 Like

Ironically it needed @Paul-Reed and myself in series to solve it :slight_smile:


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