diff --git a/services/blob/src/Reactors/server/PutReactor.h b/services/blob/src/Reactors/server/PutReactor.h --- a/services/blob/src/Reactors/server/PutReactor.h +++ b/services/blob/src/Reactors/server/PutReactor.h @@ -75,8 +75,15 @@ if (!this->status.status.ok()) { return; } - if (this->uploader == nullptr && !this->dataExists) { - throw std::runtime_error("uploader not initialized as expected"); + const database::ReverseIndexItem reverseIndexItem( + this->holder, this->blobHash); + if (this->uploader == nullptr) { + if (!this->dataExists) { + throw std::runtime_error("uploader not initialized as expected"); + } + database::DatabaseManager::getInstance().putReverseIndexItem( + reverseIndexItem); + return; } if (this->uploader == nullptr) { return; @@ -89,7 +96,6 @@ } this->uploader->finishUpload(); database::DatabaseManager::getInstance().putBlobItem(*this->blobItem); - const database::ReverseIndexItem reverseIndexItem(holder, this->blobHash); database::DatabaseManager::getInstance().putReverseIndexItem( reverseIndexItem); }