Page MenuHomePhabricator

D4089.id12933.diff
No OneTemporary

D4089.id12933.diff

diff --git a/services/backup/src/Reactors/server/AddAttachmentReactor.cpp b/services/backup/src/Reactors/server/AddAttachmentReactor.cpp
--- a/services/backup/src/Reactors/server/AddAttachmentReactor.cpp
+++ b/services/backup/src/Reactors/server/AddAttachmentReactor.cpp
@@ -120,6 +120,23 @@
}
void AddAttachmentReactor::terminateCallback() {
+ const std::lock_guard<std::mutex> lock(this->reactorStateMutex);
+
+ if (this->putReactor == nullptr) {
+ throw std::runtime_error(
+ "invalid state: put reactor not initialized when terminating the "
+ "reactor");
+ }
+ this->putReactor->scheduleSendingDataChunk(std::make_unique<std::string>(""));
+ std::unique_lock<std::mutex> lockPut(this->blobPutDoneCVMutex);
+ if (this->putReactor->getStatusHolder()->state != ReactorState::DONE) {
+ this->blobPutDoneCV.wait(lockPut);
+ } else if (!this->putReactor->getStatusHolder()->getStatus().ok()) {
+ throw std::runtime_error(
+ this->putReactor->getStatusHolder()->getStatus().error_message());
+ }
+ // store in db only when we successfully upload chunks
+ this->storeInDatabase();
}
} // namespace reactor

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 10:58 AM (7 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2725844
Default Alt Text
D4089.id12933.diff (1 KB)

Event Timeline