# Delay node rate limit for each msg.topic

**URL:** <https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333>\
**Category:** General\
**Created:** [5 December 2026 14:51 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333 "2026-12-05T14:51:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2026 14:51 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/1 "2026-12-05T14:51:31Z")

</div>

With these settings, I think a single message sent to the delay node ought to be passed through immediately?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/5987a76dcd889dc26394dc338a0dc44b5d56e522.png)

However in fact it takes 2 or more seconds (variable) before it is emitted.  
The delay node status shows that the message is added to a queue, but usually not for the full 5 sec mentioned in config.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24977412194afbbed45cf386a5f296065c0d21f1.png)

If instead the delay node is set to "All messages - even spacing" the message is emitted immediately.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/9/192a435e78f4c26dbf4fb72a09572bdc2df4b9ea.png)

Example flow

```auto
[{"id":"aea10d23c5aaba08","type":"group","z":"80165dd016537033","name":"Immediate pass-through","style":{"label":true},"nodes":["f947962fa27883a7","a5c0a2d7f8fe1657","676a7eb5a11c7023","2315449fbdba6f03"],"x":454,"y":19,"w":472,"h":202},{"id":"f947962fa27883a7","type":"inject","z":"80165dd016537033","g":"aea10d23c5aaba08","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"aaa","payloadType":"str","x":550,"y":120,"wires":[["a5c0a2d7f8fe1657","2315449fbdba6f03"]]},{"id":"a5c0a2d7f8fe1657","type":"delay","z":"80165dd016537033","g":"aea10d23c5aaba08","name":"All Messages Drop Intermediate","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":770,"y":120,"wires":[["676a7eb5a11c7023"]]},{"id":"676a7eb5a11c7023","type":"debug","z":"80165dd016537033","g":"aea10d23c5aaba08","name":"Output All msgs","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":180,"wires":[]},{"id":"2315449fbdba6f03","type":"debug","z":"80165dd016537033","g":"aea10d23c5aaba08","name":"Go","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":60,"wires":[]},{"id":"3a24e5b13a0a5f87","type":"group","z":"80165dd016537033","name":"Random undesirable delay","style":{"label":true},"nodes":["81292bc1530dda28","86cd80201e6a55e7","138dc4d13880ca4b","e72afe613c170dcd"],"x":454,"y":239,"w":472,"h":202},{"id":"81292bc1530dda28","type":"debug","z":"80165dd016537033","g":"3a24e5b13a0a5f87","name":"Go","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":690,"y":280,"wires":[]},{"id":"86cd80201e6a55e7","type":"inject","z":"80165dd016537033","g":"3a24e5b13a0a5f87","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"a","payload":"aaa","payloadType":"str","x":550,"y":340,"wires":[["138dc4d13880ca4b","81292bc1530dda28"]]},{"id":"138dc4d13880ca4b","type":"delay","z":"80165dd016537033","g":"3a24e5b13a0a5f87","name":"Per msg.topic Drop Intermediate","pauseType":"timed","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":770,"y":340,"wires":[["e72afe613c170dcd"]]},{"id":"e72afe613c170dcd","type":"debug","z":"80165dd016537033","g":"3a24e5b13a0a5f87","name":"Output All msgs","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":400,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [5 December 2026 15:58 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/2 "2026-12-05T15:58:54Z")

</div>

Do you have anything else going on in that instance? Or have a heavily loaded machine?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2026 16:02 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/3 "2026-12-05T16:02:08Z")

</div>

I wondered about the machine load, especially considering that the delay varies from 1 to 5 or more sec.  
This is a Pi 4 and there are a shed load of flows, but mostly disabled.

But the alternative setting which passes the message through immediately (and does not seem to update the status number of queued messages) seems to exclude this explanation.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [5 December 2026 16:11 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/4 "2026-12-05T16:11:44Z")

</div>

Can't think what else could cause that kind of variability to be honest.

I've been doing some performance testing myself recently and I was amazed how variable performance can be deep within the bowels of node.js. My node startup times can vary enormously. By 1/2sec or more quite easily between runs with no other changes and using a clean instance of Node-RED. Of course, this is on a Windows desktop so you do expect some variation, but still.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 December 2026 16:14 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/5 "2026-12-05T16:14:32Z")

</div>

I think that is how it works in that mode. From the help text:

The rate limiting can be applied to all messages, or group them according to their msg.topic value. When grouping, intermediate messages are automatically dropped. At each time interval, the node can either release the most recent message for all topics, or release the most recent message for the next topic.

When grouping by topic it only releases on the time intervals, so when you send in the first one it has to wait for the next interval tick.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2026 16:26 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/6 "2026-12-05T16:26:47Z")

</div>

> [@Colin](#):
>
> When grouping by topic it only releases on the time intervals, so when you send in the first one it has to wait for the next interval tick.

I thought there might be something like that going on but does it make sense that a 5 seconds timer starts even before the first message has arrived, merely because the config mentions 5 sec?

In my use case I'm trying to reduce double MQTT LWT messages ("Disconnect" followed immediately by "Connect") to a single one _per topic_ unless there is a significant delay between them.  
I can't have a switch and delay node per topic because new sensors may turn up.  
I can't use a filter node because the payload does change.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 December 2026 21:56 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/7 "2026-12-05T21:56:50Z")

</div>

I haven't got time to look at the moment, but I would have thought a trigger node would do that. It can be topic based too. Send Nothing then after 5 secs send Latest?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [5 December 2026 22:02 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/8 "2026-12-05T22:02:04Z")

</div>

Perhaps I did not explain very well.

I do not want to "send nothing for 5 seconds".  
I want to send the first message for each topic immediately then nothing further for that topic for 5 seconds.

It seems pretty clear to me that the behaviour of the node could be described as a bug. On the other hand, I've been wrong before.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 December 2026 08:22 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/9 "2026-12-06T08:22:43Z")

</div>

Sorry - it is working as designed - just not for your use case 🙂  
It was designed as a sort of fair store and forward queue for low bandwidth links, so that (say) urgent messages could be inserted into a flow of higher volume but less important messages -eg chat vs position updates. When in per topic mode it can either release one topic per tick (round robin), or a bunch that have arrived (latest msg per topic but all topics). In this use case it doesn't matter when you "start" and in fact is just as preferable to wait to see if any other topics turn up - so the repeating tick timer just starts at deploy time so the delay could be anything from 0 to x where x is the configured time.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 December 2026 09:05 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/10 "2026-12-06T09:05:59Z")

</div>

> [@jbudd](#):
>
> In my use case I'm trying to reduce double MQTT LWT messages ("Disconnect" followed immediately by "Connect") to a single one _per topic_ unless there is a significant delay between them.

> [@jbudd](#):
>
> I want to send the first message for each topic immediately then nothing further for that topic for 5 seconds.

I don't understand. If you want to reduce two messages, Disconnect followed by Connect, then don't you want the single message to be Connect?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [6 December 2026 10:44 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/11 "2026-12-06T10:44:33Z")

</div>

> [@dceejay](#):
>
> so that (say) urgent messages could be inserted into a flow of higher volume but less important messages  
> ...  
> In this use case it doesn't matter when you "start" and in fact is just as preferable to wait to see if any other topics turn up -

I can't reconcile these two statements.

It's surely not ideal when the first {topic: "Fire Alarm", payload "Evacuate"} message arrives for it to be delayed for an arbitrary time waiting to see if some other message turns up.

I would have thought that if the node is in per topic mode, arrival of a message should start a timer for that topic, possibly set by msg.rate, if that option is ticked:

"High Wind" - Is high wind timer running? Yes - discard message.  
"Fire Alarm" - Is fire alarm timer running? No - start one, pass message.

No doubt such a design would have it's own undesirable effects.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [6 December 2026 11:03 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-for-each-msg-topic/102333/12 "2026-12-06T11:03:25Z")

</div>

If the current node isn't doing it for you, other than adding a new mode to it, you can always use a function node to provide the custom logic.

Once you have the logic sorted, there is a fair chance that a free session with Claude AI could build a working node.
