Defer ExecuteCommandProcessFinishedHandler

This commit is contained in:
Mattia Codato 2020-07-13 17:49:38 +02:00
parent 134a43d48a
commit 2db7b10ff0
1 changed files with 9 additions and 0 deletions

View File

@ -97,6 +97,14 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
return;
}
bool executeCommandProcessFinishedHandlerToBeReset = false;
Defer resetExecuteCommandProcessFinishedHandler ([&executeCommandProcessFinishedHandlerToBeReset]() {
if (executeCommandProcessFinishedHandlerToBeReset) {
Checkable::ExecuteCommandProcessFinishedHandler = nullptr;
executeCommandProcessFinishedHandlerToBeReset = false;
}
});
if (params->Contains("source")) {
String uuid = params->Get("source");
@ -176,6 +184,7 @@ void ClusterEvents::ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, cons
listener->SyncSendMessage(sourceEndpoint, executedMessage);
}
};
executeCommandProcessFinishedHandlerToBeReset = true;
}
if (!listener->GetAcceptCommands()) {