aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-03-29 17:09:33 +0200
committerGitHub <[email protected]>2022-03-29 17:09:33 +0200
commit102b612e405630683487ce4e63b6cb0042944ddc (patch)
tree978da68e9e28bded29f79856e076e3c8f4fdbb36 /zenserver/cache/structuredcachestore.cpp
parentMerge branch 'main' of https://github.com/EpicGames/zen (diff)
parentAdd whole range in CasChunkSet::AddChunksToSet(std::span<const IoHash> Hashes... (diff)
downloadzen-102b612e405630683487ce4e63b6cb0042944ddc.tar.xz
zen-102b612e405630683487ce4e63b6cb0042944ddc.zip
Merge pull request #64 from EpicGames/de/fix-cachebucket-gatherreferences
Clear gathered Cid array periodically and add just the new ones
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
-rw-r--r--zenserver/cache/structuredcachestore.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index de5bccc3a..66f32c858 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -773,7 +773,7 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
return Entry.LastAccess < Ticks;
});
- Cids.reserve(Entries.size());
+ Cids.reserve(1024);
for (auto Kv = ValidIt; Kv != Entries.end(); ++Kv)
{
@@ -791,10 +791,13 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx)
if (CacheValue.Value)
{
ZEN_ASSERT(CacheValue.Value.GetContentType() == ZenContentType::kCbObject);
-
+ if (Cids.size() > 1024)
+ {
+ GcCtx.ContributeCids(Cids);
+ Cids.clear();
+ }
CbObject Obj(SharedBuffer{CacheValue.Value});
Obj.IterateAttachments([&Cids](CbFieldView Field) { Cids.push_back(Field.AsAttachment()); });
- GcCtx.ContributeCids(Cids);
}
}
}