aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-05-16 12:23:42 +0200
committerGitHub <[email protected]>2023-05-16 12:23:42 +0200
commita4ff07d68eeae66c008bfac28cb87c94a92cf257 (patch)
tree630940f228c35d29fac31ced2ba7f9fd16fca1c8 /src/zenserver/projectstore/projectstore.cpp
parentAdded CHANGELOG.md descriptions for recent changes (diff)
downloadzen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.tar.xz
zen-a4ff07d68eeae66c008bfac28cb87c94a92cf257.zip
Add `--gc-projectstore-duration-seconds` option (#281)
* Add `--gc-projectstore-duration-seconds` option * Cleanup lua gc options parsing * Remove dead configuration values * changelog
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 03c1e8927..0beb207ae 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1581,7 +1581,7 @@ ProjectStore::Project::GatherReferences(GcContext& GcCtx)
}
IterateOplogs([&](Oplog& Ops) {
- if (!IsExpired(GcCtx.ExpireTime(), Ops))
+ if (!IsExpired(GcCtx.ProjectStoreExpireTime(), Ops))
{
Ops.GatherReferences(GcCtx);
}
@@ -1804,7 +1804,7 @@ ProjectStore::GatherReferences(GcContext& GcCtx)
for (auto& Kv : m_Projects)
{
- if (Kv.second->IsExpired(GcCtx.ExpireTime()))
+ if (Kv.second->IsExpired(GcCtx.ProjectStoreExpireTime()))
{
ExpiredProjectCount++;
continue;
@@ -1842,7 +1842,7 @@ ProjectStore::CollectGarbage(GcContext& GcCtx)
RwLock::SharedLockScope _(m_ProjectsLock);
for (auto& Kv : m_Projects)
{
- if (Kv.second->IsExpired(GcCtx.ExpireTime()))
+ if (Kv.second->IsExpired(GcCtx.ProjectStoreExpireTime()))
{
ExpiredProjects.push_back(Kv.second);
ExpiredProjectCount++;
@@ -1865,7 +1865,7 @@ ProjectStore::CollectGarbage(GcContext& GcCtx)
{
RwLock::ExclusiveLockScope _(m_ProjectsLock);
Project->IterateOplogs([&GcCtx, &Project, &ExpiredOplogs](ProjectStore::Oplog& Oplog) {
- if (Project->IsExpired(GcCtx.ExpireTime(), Oplog))
+ if (Project->IsExpired(GcCtx.ProjectStoreExpireTime(), Oplog))
{
ExpiredOplogs.push_back(Oplog.OplogId());
}
@@ -1893,7 +1893,7 @@ ProjectStore::CollectGarbage(GcContext& GcCtx)
std::string ProjectId;
{
RwLock::ExclusiveLockScope _(m_ProjectsLock);
- if (!Project->IsExpired(GcCtx.ExpireTime()))
+ if (!Project->IsExpired(GcCtx.ProjectStoreExpireTime()))
{
ZEN_DEBUG("ProjectStore::CollectGarbage skipped garbage collect of project '{}'. Project no longer expired.", ProjectId);
continue;
@@ -4173,7 +4173,7 @@ TEST_CASE("project.store.gc")
}
{
- GcContext GcCtx(GcClock::Now() - std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4184,7 +4184,7 @@ TEST_CASE("project.store.gc")
}
{
- GcContext GcCtx(GcClock::Now() + std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() + std::chrono::hours(24), GcClock::Now() + std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4197,7 +4197,7 @@ TEST_CASE("project.store.gc")
std::filesystem::remove(Project1FilePath);
{
- GcContext GcCtx(GcClock::Now() - std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4208,7 +4208,7 @@ TEST_CASE("project.store.gc")
}
{
- GcContext GcCtx(GcClock::Now() + std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() + std::chrono::hours(24), GcClock::Now() + std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4220,7 +4220,7 @@ TEST_CASE("project.store.gc")
std::filesystem::remove(Project2OplogPath);
{
- GcContext GcCtx(GcClock::Now() - std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() - std::chrono::hours(24), GcClock::Now() - std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4231,7 +4231,7 @@ TEST_CASE("project.store.gc")
}
{
- GcContext GcCtx(GcClock::Now() + std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() + std::chrono::hours(24), GcClock::Now() + std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });
@@ -4243,7 +4243,7 @@ TEST_CASE("project.store.gc")
std::filesystem::remove(Project2FilePath);
{
- GcContext GcCtx(GcClock::Now() + std::chrono::hours(24));
+ GcContext GcCtx(GcClock::Now() + std::chrono::hours(24), GcClock::Now() + std::chrono::hours(24));
ProjectStore.GatherReferences(GcCtx);
size_t RefCount = 0;
GcCtx.IterateCids([&RefCount](const IoHash&) { RefCount++; });