Delay node with rate limit by x msg / x time unit

Hello everyone,

It's about the core delay node.

I noticed that the Delay node in rate x msg / x unit time mode doesn't work as my intended.
For example, if set to 10 msg/10s it gives 1 msg/1s instead of 10 msg in 10s.
Another example, 5 msg/10s gives 1 msg/2s instead of a maximum of 5 messages every 10s.
I made a fix on my node-red with the corresponding test fixes.
This fix causes a change in the behavior of this node in rate mode with drop and without drop.

Would this correction be useful for you?


Hi @sortidocorps

I don't know of I am reading this wrong but what you say is wrong feels correct to me.

Can you show (and provide a demo flow if necessary) that shows the issues you see?

The difference is what happens if the messages come in bursts. So suppose (with 10msg/10 sec) that 5 messages arrive at time = 0, then another 5 at time = 9.9 seconds. Then the second five should (arguably) all be released immediately as there have been less than 10 messages in the last 10 seconds.

I set the delay node with rate 5 msg per 10 seconds.

In the first image, I send many messages and they are processed every 2 seconds without rate maximum limit.
One at 16:27:46, another at 16:27:48, etc

In the second image (my fix), I send many messages and they are processed every 10 seconds by 5 messages rate maximum.
5 at 16:37:56, and 5 at 16:38:06, etc

if I receive 100 messages, and I set the rate to 5 messages every 10 seconds, I just take 5 messages every 10 seconds and not 1 message every 2 seconds.

I don't know if this is clearer, or I may have misunderstood the purpose of this node in rate mode :slight_smile:

Note that the node is behaving correctly according to the help text, where is says:
"When configured to rate limit messages, their delivery is spread across the configured time period."
That says that the 5 messages should be spread across the 10 seconds, so one every 2 seconds, which is what the node is doing.
So your mod would be a change, not a bug fix.

1 Like

Ok thanks for your answer.
Is this change useful for you?
Can this modification be put in option of this node for example?
I'm using it and I thought it could be useful for other people

As that is a core node, it would need input from the core devs. You may wish to change the thread category to feature requests.

At the least, it would, in any case, need to be a new option otherwise existing flows might break.

1 Like

Thanks you.

I don't see any edit button to change the thread category to feature requests, you know how to do ?
or I have to create another ticket on thread feature request ?


Click oh the pencil icon at the end of the title

Then you can change the category

Can you describe your use case for the feature?

Thanks, but I don't see any pencil :sob:

I think I don't have the rights to do that, I just created my account the last week.

I have to recreate it and explain the use case and co

I did it for you :grinning:

1 Like