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
1 changed files with 8 additions and 6 deletions

View File

@ -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) {