diff --git a/packages/node_modules/@node-red/runtime/lib/flows/Flow.js b/packages/node_modules/@node-red/runtime/lib/flows/Flow.js index 9d97cea21..20a4f6c3d 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/Flow.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/Flow.js @@ -540,10 +540,6 @@ class Flow { } } - get asyncMessageDelivery() { - return asyncMessageDelivery - } - send(sendEvents) { // onSend - passed an array of SendEvent objects. The messages inside these objects are exactly what the node has passed to node.send - meaning there could be duplicate references to the same message object. // preRoute - called once for each SendEvent object in turn @@ -650,12 +646,18 @@ function handlePreDeliver(flow,sendEvent, reportError) { reportError(err,sendEvent); return; } else if (err !== false) { - setImmediate(function() { + if (asyncMessageDelivery) { + setImmediate(function() { + if (sendEvent.destination.node) { + sendEvent.destination.node.receive(sendEvent.msg); + } + }) + } else { if (sendEvent.destination.node) { sendEvent.destination.node.receive(sendEvent.msg); } - }) + } // postDeliver - the message has been dispatched to be delivered asynchronously (unless the sync delivery flag is set, in which case it would be continue as synchronous delivery) hooks.trigger("postDeliver", sendEvent, function(err) { if (err) {