# Wait for payload to finish flow before passing another payload

**URL:** https://discourse.nodered.org/t/wait-for-payload-to-finish-flow-before-passing-another-payload/64171
**Category:** General
**Created:** [20 June 2022 13:55 UTC](https://discourse.nodered.org/t/wait-for-payload-to-finish-flow-before-passing-another-payload/64171 "2022-06-20T13:55:44Z")
**Posts on this page:** 1
**Showing post:** 33

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [24 June 2022 16:54 UTC](https://discourse.nodered.org/t/wait-for-payload-to-finish-flow-before-passing-another-payload/64171/33 "2022-06-24T16:54:34Z")

</div>

What am I doing wrong here then? The Debug output should always show a message from the IN node, then a message from the OUT node 5 seconds later.  
Click the timestamp node and one sees IN then OUT as expected.  
Click the timestamp node twice and one sees IN, OUT, IN, OUT, also as expected.  
However, if one clicks the timestamp node twice, waits till the first OUT is seen, then clicks it again then the sequence in the debug, which should be IN, OUT, IN, OUT, IN, OUT is instead, IN, OUT, IN, IN, OUT, OUT.

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

```auto
[{"id":"b6630ded2db7d680","type":"inject","z":"bdd7be38.d3b55","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":2620,"wires":[["ed63ee4225312b40"]]},{"id":"ed63ee4225312b40","type":"delay","z":"bdd7be38.d3b55","name":"Queue","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":310,"y":2620,"wires":[["a82c03c3d34f683c","d4d479e614e82a49"]]},{"id":"a82c03c3d34f683c","type":"delay","z":"bdd7be38.d3b55","name":"Process taking 5 seconds","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":530,"y":2620,"wires":[["7c6253e5d34769ac","b23cea1074943d4d"]]},{"id":"2128a855234c1016","type":"link in","z":"bdd7be38.d3b55","name":"link in 1","links":["7c6253e5d34769ac"],"x":95,"y":2700,"wires":[["1db3d896b21fee1b"]]},{"id":"7c6253e5d34769ac","type":"link out","z":"bdd7be38.d3b55","name":"link out 1","mode":"link","links":["2128a855234c1016"],"x":665,"y":2700,"wires":[]},{"id":"1db3d896b21fee1b","type":"change","z":"bdd7be38.d3b55","name":"Flush","rules":[{"t":"set","p":"flush","pt":"msg","to":"1","tot":"num"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"delete","p":"_event","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":2700,"wires":[["ed63ee4225312b40"]]},{"id":"b23cea1074943d4d","type":"debug","z":"bdd7be38.d3b55","name":"OUT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":2540,"wires":[]},{"id":"d4d479e614e82a49","type":"debug","z":"bdd7be38.d3b55","name":"IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":2540,"wires":[]}]

```

---

_[View the full topic](https://discourse.nodered.org/t/wait-for-payload-to-finish-flow-before-passing-another-payload/64171)._
