1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Restore support for runtimeSyncDelivery flag

This commit is contained in:
Nick O'Leary 2020-09-29 17:39:29 +01:00
parent 7a90fe5aec
commit 517e376582
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -540,10 +540,6 @@ class Flow {
} }
} }
get asyncMessageDelivery() {
return asyncMessageDelivery
}
send(sendEvents) { 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. // 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 // preRoute - called once for each SendEvent object in turn
@ -650,12 +646,18 @@ function handlePreDeliver(flow,sendEvent, reportError) {
reportError(err,sendEvent); reportError(err,sendEvent);
return; return;
} else if (err !== false) { } 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) { if (sendEvent.destination.node) {
sendEvent.destination.node.receive(sendEvent.msg); 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) // 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) { hooks.trigger("postDeliver", sendEvent, function(err) {
if (err) { if (err) {