# \[enhancement\]to Rate limiting in Delay node to work in milliseconds

**URL:** https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514
**Category:** Feature Requests
**Created:** [23 August 2018 15:03 UTC](https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514 "2018-08-23T15:03:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [23 August 2018 15:03 UTC](https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514/1 "2018-08-23T15:03:16Z")

</div>

I was wanting to use the Delay node in rate limiting mode to control a string of leds but it has a minimum rate of 1 msg/sec

Could it be changed to allow milliseconds as well as secs/minutes/hours/days as it does in standard Delay mode please?

Happy to do mods myself and do a pull-request if required

Simon

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [23 August 2018 15:36 UTC](https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514/2 "2018-08-23T15:36:07Z")

</div>

silly me 🙂  
I'd forgotton about the laws of mathematics 😲

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

---

<div class="post-metadata">

### Author: ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)
#### Post date: [23 August 2018 17:17 UTC](https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514/3 "2018-08-23T17:17:37Z")

</div>

Helllo Cymplecy

Have you tried to set to rate limit fractions of second like 0.1 for example?

Take into consideration that you need to select the option of "drop intermediate messages" otherwise the messages coming after are just delayed.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/1a70d9ba738e07c485fd3ed9ec79a5fe16a189c2.png)

From other side consider node-red is not a real time system and depends on processor availability etc.... so working with very low precise times is not the goal and will be more reliable depending on the application to let this to work on an arduino board for example that you can control with node red.

All depending on real needs....

I want to point you one thing that is important to realize.... is not the same:

- Rate limit 1 message every 250 miliseconds  
-Rate limit 4 messages per seconds

I can explain you better but most probably you already see the difference. The final result on the behavior will be slightly different, have it on mind.

In the example you show suppose the case you are reviving a message every 0.1 sec, what will happen is on first second you will see coming out the messages emitted at 0.1,0.2,0.3 and 0.4 then nothing and after first second is over you will see coming messages emitted at 0.5,0.6,0.7 and 0.8.

If you select intermediate messages drop when first second is over then you will see coming messages emitted at 1.1,1.2,1.3 and 1.4.

This is not the same that allow only 1 message every 250 milliseconds and drop intermediate ones.

Regards

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [23 August 2018 17:42 UTC](https://discourse.nodered.org/t/enhancement-to-rate-limiting-in-delay-node-to-work-in-milliseconds/2514/4 "2018-08-23T17:42:29Z")

</div>

> [@davidcgu](#):
>
> In the example you show suppose the case you are reviving a message every 0.1 sec, what will happen is on first second you will see coming out the messages emitted at 0.1,0.2,0.3 and 0.4 then nothing and after first second is over you will see coming messages emitted at 0.5,0.6,0.7 and 0.8.
> 
> If you select intermediate messages drop when first second is over then you will see coming messages emitted at 1.1,1.2,1.3 and 1.4.
> 
> This is not the same that allow only 1 message every 250 milliseconds and drop intermediate ones.

Your quite right - I was wondering why the 1st few leds were coming on together when I redeployed 🙂

Luckily, that is not a real issue for me as it works as I want after the 1st wave - the next time I trigger my flow - all the leds change at same rate as each other.

But good to know why things happen the way they do in Node-RED 🙂
