diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/SendLogReactor.h @@ -40,6 +40,7 @@ // `persistedInBlob` is false) or the holder to blob (if `persistedInBlob` is // true) std::string value; + std::mutex reactorStateMutex; std::condition_variable blobDoneCV; std::shared_ptr putReactor; @@ -94,6 +95,9 @@ std::unique_ptr SendLogReactor::readRequest(backup::SendLogRequest request) { + // we make sure that the blob client's state is flushed to the main memory + // as there may be multiple threads from the pool taking over here + const std::lock_guard lock(this->reactorStateMutex); switch (this->state) { case State::USER_ID: { if (!request.has_userid()) { @@ -150,6 +154,9 @@ } void SendLogReactor::doneCallback() { + // we make sure that the blob client's state is flushed to the main memory + // as there may be multiple threads from the pool taking over here + const std::lock_guard lock(this->reactorStateMutex); // TODO implement std::cout << "receive logs done " << this->status.error_code() << "/" << this->status.error_message() << std::endl;