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.

7 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?

    Thanks!

    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.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>