# How to cancel delay action

**URL:** <https://discourse.nodered.org/t/how-to-cancel-delay-action/47853>\
**Category:** General\
**Created:** [30 June 2021 17:40 UTC](https://discourse.nodered.org/t/how-to-cancel-delay-action/47853 "2021-06-30T17:40:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidfigueroa](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@davidfigueroa](https://discourse.nodered.org/u/davidfigueroa)\
**Post date:** [30 June 2021 17:40 UTC](https://discourse.nodered.org/t/how-to-cancel-delay-action/47853/1 "2021-06-30T17:40:30Z")

</div>

am new to node-red and I want to know how to cancel the action of a delay if it is already activated by sending another msg.  
if i send a msg.payload 176 \> to the limit it sends a "true" to a delay that if in 10 s it doesn't normalize it sends a 0. i want to stop the delay sending another msg if it normalizes to 176.

[{"id":"988a6253.bc2b5","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"e615f542.6ab088","type":"inject","z":"988a6253.bc2b5","name":"IPC","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"176","payloadType":"num","x":220,"y":160,"wires":[["d1e5c23e.9ef6b"]]},{"id":"2e4db80a.7ac928","type":"delay","z":"988a6253.bc2b5","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":660,"y":200,"wires":[["9b1b73b.b640c9"]]},{"id":"9b1b73b.b640c9","type":"function","z":"988a6253.bc2b5","name":"","func":"if (msg.payload == true){\n \n msg.payload = 0;\n \n} else\n{\n \n msg.payload = 176;\n} \n \n\nreturn msg; \n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":820,"y":260,"wires":[["b31cda3.7080628"]]},{"id":"c76c7c63.a546","type":"inject","z":"988a6253.bc2b5","name":"T140","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"246","payloadType":"num","x":220,"y":260,"wires":[["d1e5c23e.9ef6b"]]},{"id":"d1e5c23e.9ef6b","type":"function","z":"988a6253.bc2b5","name":"","func":"if(msg.payload \>= 246 ){\n \n msg.payload = true;\n \n\n}else{\n \n msg.payload = msg.payload\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":200,"wires":[["2e4db80a.7ac928"]]},{"id":"b31cda3.7080628","type":"debug","z":"988a6253.bc2b5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1010,"y":260,"wires":}]

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [30 June 2021 17:58 UTC](https://discourse.nodered.org/t/how-to-cancel-delay-action/47853/2 "2021-06-30T17:58:36Z")

</div>

Hi,

Your flow can't be imported.  
Please read [this](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506/4) how to post your flow.

If you are using the Delay node, this are the options according the help:  
**reset**  
If the received message has this property set to any value, all outstanding messages held by the node are cleared without being sent.  
**flush**  
If the received message has this property set to any value, all outstanding messages held by the node are sent immediately.

Maybe this can help you.

---

<div class="post-metadata">

**Author:** ![davidfigueroa](https://avatars.discourse-cdn.com/v4/letter/d/a9adbd/32.png) [@davidfigueroa](https://discourse.nodered.org/u/davidfigueroa)\
**Post date:** [30 June 2021 18:45 UTC](https://discourse.nodered.org/t/how-to-cancel-delay-action/47853/3 "2021-06-30T18:45:25Z")

</div>

if you served me the msg.reset thank you

---

<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:** [29 August 2021 18:46 UTC](https://discourse.nodered.org/t/how-to-cancel-delay-action/47853/4 "2021-08-29T18:46:19Z")

</div>

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