ensure the operation method msg is run after the client result to match 2.x behavior

This commit is contained in:
Nacho Codoñer
2024-03-05 11:51:33 +01:00
parent 3fa843afb1
commit 47ed012b0f

View File

@@ -850,7 +850,17 @@ export class Connection {
}
// If we added it to the first block, send it out now.
if (self._outstandingMethodBlocks.length === 1) methodInvoker.sendMessage();
if (self._outstandingMethodBlocks.length === 1) {
if (callback && future) {
// Ensure the method message after the result of the method ran in the client.
future = new Promise((resolve) => {
methodInvoker.sendMessage();
resolve();
});
} else {
methodInvoker.sendMessage();
}
}
// If we're using the default callback on the server,
// block waiting for the result.