Node-Red – Delay Node (formally Pause Node)

I’ve just been updating my Pause node for Node-Red after a request to support message rate limiting as well as pausing individual messages.

To help make it a little clearer the node has also been renamed to Delay (thanks to deldrid1 for the suggestion)

Delay Mode

In this mode the node allows you to delay any message passing through it by a given number of milliseconds, seconds, hours or days.

Rate Limit Mode

This time the node ensures that no more than the given number of messages are delivered per millisecond, second, hour or day.

All the code is in my fork of the original project for now and soon to be rolled up in to the main stream.

9 thoughts on “Node-Red – Delay Node (formally Pause Node)”

  1. Hi!

    Will this delay prevent a new instance of the flow coming from the inject node if the inject node is set to fire every x seconds? So will it effectively pause the whole flow?


    1. The delay is applied to each message as it transits the flow. e.g. if inject fires once a second and the delay is set to 5 seconds then all messages will enter the flow, pass through all nodes before the delay, wait at the delay for 5 seconds, then continue to any other nodes down stream.

  2. This article is a bit out-of-date. You state that the delay node handles milliseconds, but it’s actually limited to seconds as the smallest unit. Did it handle milliseconds at one time? I need that feature. Any suggestions?

    1. Not sure what you mean, the delay node drop down still lists the millisecond option for me (using the latest Node-RED build 0.17.5) and always has.

      1. Sorry, my mistake. I’m using the “Limit rate to” feature of the delay node, which only works in seconds, minutes, hours and days. Do you happen to know the reason it doesn’t handle milliseconds?

        1. Because you don’t need it and you should also be very careful with trying to set a rate limit too high.

          Just set the rate to how ever many messages you need per second e.g.

          4 message in 1 second -> 1 message every 250 milliseconds.

          You probably don’t want to go down to more than 1 message every 100ms as if you are competing with EVERYTHING else on the event loop and if anything slows things down then your very quickly going to back up a LOT of messages in memory and likely blow the heap up.

  3. Hello,
    I try to set the delay-time (“Set delay with msg.delay”) with a number-input to change the delay time on the fly. But I always get an error:
    msg.payload : undefined - undefined"
    What type does the function need – numeric, int, string…?

    This is what I do :
    numeric-node –> function-node –> delay-node
    var msgss = msg.payload; // from numeric-node

    node.send({delay: msgss}); // send the number from the numeric-node to the delay.-input of the delay-node

    return {null}; // no message through the delay

    Thank you and best regards,

    1. This blog post is about the original delay node before it was added to the core set of nodes that ship with Node-RED. You will do much better asking questions on the Google Group mailing list or the Node-RED Slack channel (both linked to from the Node-RED homepage).

      The msg.delay should be attached to the message you want to delay, not a msg on it’s own. You can not change the default, only for a specific message.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.