Commit c07aca06 authored by Elvin Sindrilaru's avatar Elvin Sindrilaru

MGM: Fix accounting for proc commands whose clients disconnected before the command was executed

parent 5ff49dd6
Pipeline #500050 canceled with stages
in 28 seconds
......@@ -188,17 +188,22 @@ IProcCommand::LaunchJob()
bool
IProcCommand::KillJob()
{
if (!mDoAsync) {
return true;
}
bool is_killed = true;
mForceKill.store(true);
if (mDoAsync) {
mForceKill.store(true);
if (mFuture.valid()) {
return (mFuture.wait_for(std::chrono::seconds(0)) == std::future_status::ready);
} else {
return true;
if (mFuture.valid()) {
is_killed = (mFuture.wait_for(std::chrono::seconds(0)) ==
std::future_status::ready);
}
}
if (is_killed) {
--mCmdsExecuting[mReqProto.command_case()];
}
return is_killed;
}
//------------------------------------------------------------------------------
......@@ -439,7 +444,7 @@ IProcCommand::IsOperationForbidden(const char* inpath)
bool
IProcCommand::HasSlot(const eos::console::RequestProto& req_proto)
{
static bool init = false;
static std::atomic<bool> init {false};
// Initialize only once in the beginning
if (!init) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment