# Delay - wait in loop/function

**URL:** <https://discourse.nodered.org/t/delay-wait-in-loop-function/33508>\
**Category:** General\
**Created:** [29 September 2020 13:17 UTC](https://discourse.nodered.org/t/delay-wait-in-loop-function/33508 "2020-09-29T13:17:56Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [29 September 2020 14:10 UTC](https://discourse.nodered.org/t/delay-wait-in-loop-function/33508/7 "2020-09-29T14:10:26Z")

</div>

Take a look :

> [@Delay node with variable delay](https://discourse.nodered.org/t/delay-node-with-variable-delay/18486/7):
>
> Ok, I made a big mistake with my reply. I made it. Not you. The msg.delay needs to be sent with the message. So: If you send msg.delay 3000 then send msg.payload Hello through the delay node as is, it will default to 1000 ms. What you need to do is send a message with both the payload and the delay parts. This is tricky because you need to store the delay value for subsequent messages. I don't know how much you know about Node-Red. (No problem. We all start at the bottom and work up.) …

> [@How to both reset & set delay in "delay node"](https://discourse.nodered.org/t/how-to-both-reset-set-delay-in-delay-node/14999/4):
>
> Thank you, it works , but I needed to increase delay, 8ms was not reliable enough,

> [@DELAY node - variable delay not seeming to work](https://discourse.nodered.org/t/delay-node-variable-delay-not-seeming-to-work/14603/4):
>
> Use a flow context variable to store the your desired message delay value. Then use a Change node immediately before the Delay node to set msg.delay to the value of that flow context variable.

---

_[View the full topic](https://discourse.nodered.org/t/delay-wait-in-loop-function/33508)._
