aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index 9f63699e5..fcd10bdac 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -725,23 +725,28 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c
DataFile.MoveTemporaryIntoPlace(FsPath, Ec);
- if (Ec)
+ if (!Ec)
{
- std::error_code InnerEc;
- const uint64_t ExistingFileSize = std::filesystem::file_size(FsPath, InnerEc);
+ break;
+ }
- if (!InnerEc && ExistingFileSize == Value.Value.Size())
- {
- // Concurrent write of same value?
- return;
- }
+ std::error_code InnerEc;
+ const uint64_t ExistingFileSize = std::filesystem::file_size(FsPath, InnerEc);
+
+ if (!InnerEc && ExistingFileSize == Value.Value.Size())
+ {
+ // Concurrent write of same value?
+ return;
}
// Semi arbitrary back-off
zen::Sleep(1000 * RetryCount);
} while (RetryCount--);
- throw std::system_error(Ec, "Failed to finalize file '{}'"_format(WideToUtf8(DataFilePath)));
+ if (Ec)
+ {
+ throw std::system_error(Ec, "Failed to finalize file '{}'"_format(WideToUtf8(DataFilePath)));
+ }
}
// Update index