diff options
| author | Dan Engelbrecht <[email protected]> | 2024-03-23 10:56:58 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-03-23 10:56:58 +0100 |
| commit | 16b048927c7133b2a9f40ec26dd9c5433c91be2f (patch) | |
| tree | 878c764797c401d68e7229f7f7bbc08cdedfc2de | |
| parent | re-enable partial cache chunks (#21) (diff) | |
| download | zen-5.4.2-pre14.tar.xz zen-5.4.2-pre14.zip | |
use batch request for checking existing blocks as Jupiter is now fixed (#20)v5.4.2-pre15v5.4.2-pre14
| -rw-r--r-- | src/zenserver/projectstore/jupiterremoteprojectstore.cpp | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/src/zenserver/projectstore/jupiterremoteprojectstore.cpp b/src/zenserver/projectstore/jupiterremoteprojectstore.cpp index b288a667c..1508dbc3f 100644 --- a/src/zenserver/projectstore/jupiterremoteprojectstore.cpp +++ b/src/zenserver/projectstore/jupiterremoteprojectstore.cpp @@ -134,49 +134,18 @@ public: virtual HasAttachmentsResult HasAttachments(const std::span<IoHash> RawHashes) override { - CloudCacheSession Session(m_CloudClient.Get()); - const bool UseBatchRequest = - false; // The batch request API in Jupiter is currently broken so we have to resort to individual cheks - - if (UseBatchRequest) + CloudCacheSession Session(m_CloudClient.Get()); + CloudCacheExistsResult ExistsResult = Session.BlobExists(m_Namespace, std::set<IoHash>(RawHashes.begin(), RawHashes.end())); + HasAttachmentsResult Result{ConvertResult(ExistsResult), + std::unordered_set<IoHash, IoHash::Hasher>(ExistsResult.Needs.begin(), ExistsResult.Needs.end())}; + if (ExistsResult.ErrorCode) { - CloudCacheExistsResult ExistsResult = Session.BlobExists(m_Namespace, std::set<IoHash>(RawHashes.begin(), RawHashes.end())); - HasAttachmentsResult Result{ConvertResult(ExistsResult), - std::unordered_set<IoHash, IoHash::Hasher>(ExistsResult.Needs.begin(), ExistsResult.Needs.end())}; - if (ExistsResult.ErrorCode) - { - Result.Reason = fmt::format("Failed checking attachment existance in {}/{}. Reason: '{}'", - m_CloudClient->ServiceUrl(), - m_Namespace, - Result.Reason); - } - return Result; - } - else - { - Stopwatch Timer; - HasAttachmentsResult Result; - for (const IoHash& RawHash : RawHashes) - { - CloudCacheResult ExistsResult = Session.CompressedBlobExists(m_Namespace, RawHash); - if (ExistsResult.ErrorCode) - { - Result = {ConvertResult(ExistsResult)}; - Result.Reason = fmt::format("Failed checking oplog attachment existance {}/{}/{}. Reason: '{}'", - m_CloudClient->ServiceUrl(), - m_Namespace, - RawHash, - Result.Reason); - return Result; - } - if (!ExistsResult.Success) - { - Result.Needs.insert(RawHash); - } - } - Result.ElapsedSeconds = Timer.GetElapsedTimeMs() / 1000.0; - return Result; + Result.Reason = fmt::format("Failed checking attachment existance in {}/{}. Reason: '{}'", + m_CloudClient->ServiceUrl(), + m_Namespace, + Result.Reason); } + return Result; } virtual LoadAttachmentResult LoadAttachment(const IoHash& RawHash) override |