diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h @@ -45,7 +45,7 @@ std::unique_ptr handleRequest( backup::CreateNewBackupRequest request, backup::CreateNewBackupResponse *response) override; - void terminateCallback(); + void terminateCallback() override; }; std::string CreateNewBackupReactor::generateBackupID() { @@ -109,7 +109,13 @@ } this->putReactor->scheduleSendingDataChunk(std::make_unique("")); std::unique_lock lock2(this->blobDoneCVMutex); - this->blobDoneCV.wait(lock2); + if (this->putReactor->isDone()) { + if (!this->putReactor->getStatus().ok()) { + throw std::runtime_error(this->putReactor->getStatus().error_message()); + } + } else { + this->blobDoneCV.wait(lock2); + } try { // TODO add recovery data // TODO handle attachments holders diff --git a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h --- a/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h +++ b/services/backup/docker-server/contents/server/src/Reactors/server/PullBackupReactor.h @@ -48,6 +48,7 @@ std::unique_ptr writeResponse(backup::PullBackupResponse *response) override; + void terminateCallback() override; }; PullBackupReactor::PullBackupReactor(const backup::PullBackupRequest *request) @@ -152,6 +153,12 @@ throw std::runtime_error("unhandled state"); } +void PullBackupReactor::terminateCallback() { + if (!this->getReactor->getStatus().ok()) { + throw std::runtime_error(this->getReactor->getStatus().error_message()); + } +} + } // namespace reactor } // namespace network } // namespace comm 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 @@ -189,7 +189,13 @@ } this->putReactor->scheduleSendingDataChunk(std::make_unique("")); std::unique_lock lock2(this->blobDoneCVMutex); - this->blobDoneCV.wait(lock2); + if (this->putReactor->isDone()) { + if (!this->putReactor->getStatus().ok()) { + throw std::runtime_error(this->putReactor->getStatus().error_message()); + } + } else { + this->blobDoneCV.wait(lock2); + } // store in db only when we successfully upload chunks this->storeInDatabase(); }