From 5e43b80df4cf8fff6bd350139783fb15d9d25207 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 7 Apr 2022 23:34:15 +0200 Subject: correct expire vs contribute --- zenserver/cache/structuredcachestore.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'zenserver/cache/structuredcachestore.cpp') diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 5c71ad7bb..d28964502 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -1694,21 +1694,20 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx) std::vector ExpiredKeys; ExpiredKeys.reserve(1024); + + std::vector Cids; + Cids.reserve(1024); + for (const auto& Entry : Index) { + const IoHash& Key = Entry.first; if (Entry.second.LastAccess < ExpireTicks) { - ExpiredKeys.push_back(Entry.first); + ExpiredKeys.push_back(Key); + continue; } - } - std::vector Cids; - Cids.reserve(1024); - - for (const auto& Key : ExpiredKeys) - { - IndexEntry& Entry = Index[Key]; - const DiskLocation& Loc = Entry.Location; + const DiskLocation& Loc = Entry.second.Location; if (Loc.IsFlagSet(DiskLocation::kStructured)) { @@ -1743,7 +1742,7 @@ ZenCacheDiskLayer::CacheBucket::GatherReferences(GcContext& GcCtx) } GcCtx.ContributeCids(Cids); - GcCtx.ContributeCacheKeys(m_BucketName, {}, std::move(ExpiredKeys)); + GcCtx.ContributeCacheKeys(m_BucketName, std::move(ExpiredKeys)); } void -- cgit v1.2.3