# Delay node - rate limit strange behaviour. Confusing limit rates. Is it lying us (a little)?

**URL:** <https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005>\
**Category:** General\
**Tags:** delay\
**Created:** [21 December 2025 09:35 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005 "2025-12-21T09:35:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ortegafernando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ortegafernando/32/98049_2.png) [@ortegafernando](https://discourse.nodered.org/u/ortegafernando)\
**Post date:** [21 December 2025 09:35 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/1 "2025-12-21T09:35:52Z")

</div>

Hi everyone,

I’m having a question about the Delay node in Node-RED when using the rate limit option. (Node red version 4.0.8)

For example, I configured the node to 10 messages per minute, but the behavior is not what I expected.

Instead of allowing up to 10 messages anywhere within the minute, the node seems to allow one message every 6 seconds, as if it were converting the rate limit into a fixed interval. I don't know exactly if it does maths in seconds, miliseconds, ...

In other words:

- What I expected: a maximum of 10 messages in any 60-second window
- What I get: (see and test example below)

The result is not what I expect, since I need to allow short bursts as long as the total per day is not exceeded.

Is this the expected behavior of the Delay node?  
Is there a native way (or a recommended alternative) in Node-RED to implement a true sliding-window rate limit, instead of this strange behaviour?

Thanks in advance for any help.

**Example:**

- The attached flow is a minimal example to show the behavior I’m seeing.
- Use two inject nodes.
- If you send 5 msg at 1 msg each 7 seconds, all messages are correctly sent to 1st output in delay node
- If you send 5 msg at 1 msg each 5 seconds, same of them are sent to 2nd output despite the rate is less than 10 msg/minute.
- the 10msg/min node has an strange behaviour, hasn't it?

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

```auto
[
    {
        "id": "5704b41a79567472",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "60c6aa58e443d024",
        "type": "debug",
        "z": "5704b41a79567472",
        "name": "debug",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1170,
        "y": 260,
        "wires": []
    },
    {
        "id": "fc774e569bf24db2",
        "type": "change",
        "z": "5704b41a79567472",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "out",
                "pt": "msg",
                "to": "2nd",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1030,
        "y": 320,
        "wires": [
            [
                "60c6aa58e443d024"
            ]
        ]
    },
    {
        "id": "c67a43335950adbe",
        "type": "delay",
        "z": "5704b41a79567472",
        "name": "10/min",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "10",
        "nbRateUnits": "1",
        "rateUnits": "minute",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "allowrate": false,
        "outputs": 2,
        "x": 810,
        "y": 320,
        "wires": [
            [
                "60c6aa58e443d024"
            ],
            [
                "fc774e569bf24db2"
            ]
        ]
    },
    {
        "id": "f9d520e7e8f322f3",
        "type": "inject",
        "z": "5704b41a79567472",
        "name": "",
        "props": [
            {
                "p": "timestamp",
                "v": "",
                "vt": "date"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 270,
        "y": 320,
        "wires": [
            [
                "455b795e61c69190"
            ]
        ]
    },
    {
        "id": "8eca9fe9dfbcd446",
        "type": "delay",
        "z": "5704b41a79567472",
        "name": "",
        "pauseType": "rate",
        "timeout": "7",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "7",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 640,
        "y": 320,
        "wires": [
            [
                "c67a43335950adbe"
            ]
        ]
    },
    {
        "id": "455b795e61c69190",
        "type": "function",
        "z": "5704b41a79567472",
        "name": "send 5 msg",
        "func": "const messages = [];\nfor(let i = 0; i < 5; i++){\n messages.push({\n nr: i+1\n });\n}\nreturn [messages];",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 320,
        "wires": [
            [
                "8eca9fe9dfbcd446"
            ]
        ]
    },
    {
        "id": "99f7af637ff2c8f1",
        "type": "inject",
        "z": "5704b41a79567472",
        "name": "",
        "props": [
            {
                "p": "timestamp",
                "v": "",
                "vt": "date"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 270,
        "y": 400,
        "wires": [
            [
                "7ca23bbaf6e198c4"
            ]
        ]
    },
    {
        "id": "2db82a9f2d0c4fbd",
        "type": "delay",
        "z": "5704b41a79567472",
        "name": "",
        "pauseType": "rate",
        "timeout": "7",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "5",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 640,
        "y": 400,
        "wires": [
            [
                "c67a43335950adbe"
            ]
        ]
    },
    {
        "id": "7ca23bbaf6e198c4",
        "type": "function",
        "z": "5704b41a79567472",
        "name": "send 5 msg",
        "func": "const messages = [];\nfor(let i = 0; i < 5; i++){\n messages.push({\n nr: i+1\n });\n}\nreturn [messages];",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 400,
        "wires": [
            [
                "2db82a9f2d0c4fbd"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![ortegafernando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ortegafernando/32/98049_2.png) [@ortegafernando](https://discourse.nodered.org/u/ortegafernando)\
**Post date:** [21 December 2025 09:47 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/2 "2025-12-21T09:47:54Z")

</div>

Related: [The Rate Limit node is lying to you (a little)](https://discourse.nodered.org/t/the-rate-limit-node-is-lying-to-you-a-little/98521)  
@waquete  
@HaroldPetersInskipp  
Have you found any solution?

---

<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:** [21 December 2025 10:04 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/3 "2025-12-21T10:04:26Z")

</div>

You are correct in that it converts everything into a single fixed interval. It uses a simple single timer to decide to block or allow the next message through.

---

<div class="post-metadata">

**Author:** ![ortegafernando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ortegafernando/32/98049_2.png) [@ortegafernando](https://discourse.nodered.org/u/ortegafernando)\
**Post date:** [21 December 2025 10:21 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/4 "2025-12-21T10:21:50Z")

</div>

Thanks, I think this behavior is quite confusing given the node’s configuration options and the description in its help text. Even we don't know how it converts: minutes? seconds? miliseconds?

Would it make sense to reconsider or adjust how this works? Unfortunately, I’m not able to implement such a change myself.

---

<div class="post-metadata">

**Author:** ![mudwalker](https://avatars.discourse-cdn.com/v4/letter/m/47e85d/32.png) [@mudwalker](https://discourse.nodered.org/u/mudwalker)\
**Post date:** [21 December 2025 10:46 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/5 "2025-12-21T10:46:55Z")

</div>

You could use a simple gate, open the gate, allow a count of 10 messages to go through, close the gate and then open the gate again after 1 minute (that minute starting when you decide it's reference). You could count the time in milliseconds from the timestamp, when at one minute open gate.

---

<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:** [21 December 2025 14:39 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/6 "2025-12-21T14:39:19Z")

</div>

A simple function node is a workaround for now

```auto
[{"id":"5395ba2ccbd9c367","type":"function","z":"beff51c13e9e8c28","name":"burst filter","func":"const timeout = 10000; // 10 seconds in milliseconds\nconst burst = 3; // number in burst\n\nlet inflight = context.inflight || 0;\n\nif (inflight >= burst) { \n node.status({ fill: \"red\", shape: \"dot\", text: burst });\n return; \n}\n\ninflight += 1;\n\nsetTimeout(function() {\n let v = context.inflight\n v -= 1;\n context.inflight = v;\n node.status({ fill: \"green\", shape: \"ring\", text: v });\n}, timeout)\n\ncontext.inflight = inflight;\nnode.status({ fill: \"green\", shape: \"ring\", text: inflight });\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":285,"y":112.5,"wires":[["343936e38ee83572"]]}]

```

edit the constants at the top as you desire

---

<div class="post-metadata">

**Author:** ![ortegafernando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ortegafernando/32/98049_2.png) [@ortegafernando](https://discourse.nodered.org/u/ortegafernando)\
**Post date:** [21 December 2025 17:01 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/7 "2025-12-21T17:01:57Z")

</div>

@dceejay Thanks a lot for your proposal. I have found two solutions:

1. This one: @cameo69/node-red-ratelimit
2. And yours by adding a 2nd output (in my case it is what I want). I need a daily rate limit that I exactly dont know (api calls) it works. I am not sure if it resets every day at 00:00, or it is like your code (lets say a 24hours timer that reduces inflight counter). But I am going to start your code (it will be easy to change with a first code that checks if we have "changed" the day since de previous call).

It is a pitty not to have this implemented in the delay node itself.

Thanks a lot.

```auto
const timeout = 1000*60; // 60 seconds in milliseconds
const burst = 10; // number in burst

let inflight = context.inflight || 0;

if (inflight >= burst) { 
    node.status({ fill: "red", shape: "dot", text: burst });
    return [null, msg]; 
}

inflight += 1;

setTimeout(function() {
    let v = context.inflight
    v -= 1;
    context.inflight = v;
    node.status({ fill: "green", shape: "ring", text: v });
}, timeout)

context.inflight = inflight;
node.status({ fill: "green", shape: "ring", text: inflight });

return [msg, null];

```

---

<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:** [21 December 2025 19:48 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/8 "2025-12-21T19:48:46Z")

</div>

> [@ortegafernando](#):
>
> It is a pitty not to have this implemented in the delay node itself.

but maybe...

> <https://github.com/node-red/node-red/pull/5391>
>
> and tests
> 
> 
> 
> \- \[\] Bugfix (non-breaking change which fixes an issue)
> \- \[x\] …New feature (non-breaking change which adds functionality)
> 
> 
> 
> \## Proposed changes
> 
> 
> 
> Adds a burst mode to the delay node as per this discussion - https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005 - It has also been mentioned several times before that we don't handle bursts so the present implementation is confusing.
> 
> This PR - add a new mode - burst - (vs the old mode, evenly spaced) - which allows the number of msgs specified through then blocks - using a sliding time window specified to unlock as required... messages can be dropped or sent to the second output.
> 
> \## Checklist
> 
> 
> \- \[x\] I have read the \[contribution guidelines\](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
> \- \[x\] For non-bugfix PRs, I have discussed this change on the forum/slack team.
> \- \[x\] I have run \`npm run test\` to verify the unit tests pass
> \- \[x\] I have added suitable unit tests to cover the new/changed functionality

---

<div class="post-metadata">

**Author:** ![ortegafernando](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ortegafernando/32/98049_2.png) [@ortegafernando](https://discourse.nodered.org/u/ortegafernando)\
**Post date:** [21 December 2025 23:13 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/9 "2025-12-21T23:13:32Z")

</div>

Great, thanks a lot @dceejay! I have just marked this as the solution. (If anyone reads this before the PR is merged, please check the previous post for a temporary solution.)

---

<div class="post-metadata">

**Author:** ![cameo69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cameo69/32/66593_2.png) [@cameo69](https://discourse.nodered.org/u/cameo69)\
**Post date:** [22 December 2025 08:12 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/10 "2025-12-22T08:12:50Z")

</div>

> [@ortegafernando](#):
>
> This one: @cameo69/node-red-ratelimit

Hi, you can save the hassle and use the rate limit note. It does exactly what you want. It gives you exactly the number of messages you specify in a sliding window.

---

<div class="post-metadata">

**Author:** ![Tinbum1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tinbum1/32/60100_2.png) [@Tinbum1](https://discourse.nodered.org/u/Tinbum1)\
**Post date:** [26 December 2025 11:21 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/11 "2025-12-26T11:21:02Z")

</div>

I found problems with this node and suggested it be changed but got shot down.

> [@Delay node- rate limit extension](https://discourse.nodered.org/t/delay-node-rate-limit-extension/94293):
>
> Say if; The delay node is set to rate limit to 2 messages per every 8 seconds and drop messages. If you send a message every 1 seconds it will send the first message and the 5th message. That's really not what I would expect. (That would be 1 message per every 4 seconds). I would like to suggest that it be expanded / adjusted so the rate limit can send the first 2 messages, then the 9th and 10th message, etc, etc 01/01/2025, 13:56:50[node: debug 4](http://192.168.3.194:1880/#)msg : Object { payload: 1735739809552, topic:…

---

<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:** [26 December 2025 14:39 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/12 "2025-12-26T14:39:12Z")

</div>

Ah well - good things come to he who waits...  
(assuming it gets merged 🙂 )  
Happy Xmas.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [9 January 2026 14:40 UTC](https://discourse.nodered.org/t/delay-node-rate-limit-strange-behaviour-confusing-limit-rates-is-it-lying-us-a-little/100005/13 "2026-01-09T14:40:10Z")

</div>

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