diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-29 16:58:24 +0200 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-29 16:58:24 +0200 |
| commit | 1e8884edd62c574e6fca7ed815edf504fc3f5ea3 (patch) | |
| tree | d4ae6eb8b884a3606f93d142a18717082aea262f /zenserver/cache/structuredcachestore.cpp | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen (diff) | |
| download | zen-1e8884edd62c574e6fca7ed815edf504fc3f5ea3.tar.xz zen-1e8884edd62c574e6fca7ed815edf504fc3f5ea3.zip | |
Clear gathered Cid array periodically and add just the new ones
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 9 |
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); } } } |