aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-10-16 10:53:54 +0200
committerMartin Ridgers <[email protected]>2021-10-16 10:53:54 +0200
commit8030078d08379d011781c8c09d6840fc24aaec23 (patch)
tree15c5f9b4032140211f34713a034e36ce4b697f78 /zenserver/cache/structuredcachestore.cpp
parentMerged main (diff)
parentFixed up some more windows include issues (diff)
downloadzen-8030078d08379d011781c8c09d6840fc24aaec23.tar.xz
zen-8030078d08379d011781c8c09d6840fc24aaec23.zip
Merged main
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