aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-03-16 10:56:11 +0100
committerGitHub Enterprise <[email protected]>2026-03-16 10:56:11 +0100
commit8c3ba4e8c522d119df3cb48966e36c0eaa80aeb9 (patch)
treecf51b07e097904044b4bf65bc3fe0ad14134074f /src/zenstore
parentMerge branch 'sb/no-network' of https://github.ol.epicgames.net/ue-foundation... (diff)
parentEnable cross compilation of Windows targets on Linux (#839) (diff)
downloadzen-sb/no-network.tar.xz
zen-sb/no-network.zip
Merge branch 'main' into sb/no-networksb/no-network
Diffstat (limited to 'src/zenstore')
-rw-r--r--src/zenstore/gc.cpp22
-rw-r--r--src/zenstore/xmake.lua7
2 files changed, 26 insertions, 3 deletions
diff --git a/src/zenstore/gc.cpp b/src/zenstore/gc.cpp
index b3450b805..f3edf804d 100644
--- a/src/zenstore/gc.cpp
+++ b/src/zenstore/gc.cpp
@@ -1776,11 +1776,13 @@ GcScheduler::Initialize(const GcSchedulerConfig& Config)
m_LastGcTime = GcClock::TimePoint(GcClock::Duration(SchedulerState["LastGcTime"sv].AsInt64()));
m_LastGcExpireTime =
GcClock::TimePoint(GcClock::Duration(SchedulerState["LastGcExpireTime"].AsInt64(GcClock::Duration::min().count())));
- if (m_LastGcTime + m_Config.Interval < GcClock::Now())
+ if (m_LastGcTime > GcClock::Now() || m_LastGcTime + m_Config.Interval < GcClock::Now())
{
- // TODO: Trigger GC?
+ // Reset if the stored timestamp is in the future (e.g. clock resolution mismatch
+ // between the build that wrote gc_state and this build) or too far in the past.
m_LastGcTime = GcClock::Now();
m_LastLightweightGcTime = m_LastGcTime;
+ m_LastGcExpireTime = GcClock::TimePoint::min();
}
m_AttachmentPassIndex = SchedulerState["AttachmentPassIndex"sv].AsUInt8();
}
@@ -2084,6 +2086,10 @@ GcScheduler::GetState() const
{
Result.RemainingTimeUntilFullGc = std::chrono::seconds::zero();
}
+ else if (Result.RemainingTimeUntilFullGc > Result.Config.Interval)
+ {
+ Result.RemainingTimeUntilFullGc = Result.Config.Interval;
+ }
Result.RemainingTimeUntilLightweightGc =
Result.Config.LightweightInterval.count() == 0
@@ -2094,6 +2100,10 @@ GcScheduler::GetState() const
{
Result.RemainingTimeUntilLightweightGc = std::chrono::seconds::zero();
}
+ else if (Result.RemainingTimeUntilLightweightGc > Result.Config.LightweightInterval)
+ {
+ Result.RemainingTimeUntilLightweightGc = Result.Config.LightweightInterval;
+ }
}
return Result;
@@ -2418,6 +2428,10 @@ GcScheduler::SchedulerThread()
{
RemainingTimeUntilGc = std::chrono::seconds::zero();
}
+ else if (RemainingTimeUntilGc > GcInterval)
+ {
+ RemainingTimeUntilGc = GcInterval;
+ }
std::chrono::seconds RemainingTimeUntilLightweightGc =
LightweightGcInterval.count() == 0 ? std::chrono::seconds::max()
@@ -2428,6 +2442,10 @@ GcScheduler::SchedulerThread()
{
RemainingTimeUntilLightweightGc = std::chrono::seconds::zero();
}
+ else if (RemainingTimeUntilLightweightGc > LightweightGcInterval)
+ {
+ RemainingTimeUntilLightweightGc = LightweightGcInterval;
+ }
// Don't schedule a lightweight GC if a full GC is
// due quite soon anyway
diff --git a/src/zenstore/xmake.lua b/src/zenstore/xmake.lua
index ea8155e94..94c2b51ca 100644
--- a/src/zenstore/xmake.lua
+++ b/src/zenstore/xmake.lua
@@ -6,6 +6,11 @@ target('zenstore')
add_headerfiles("**.h")
add_files("**.cpp")
add_includedirs("include", {public=true})
- add_deps("zencore", "zentelemetry", "zenutil", "zenvfs")
+ add_deps("zencore", "zentelemetry", "zenutil")
+ if is_plat("windows") then
+ add_deps("zenvfs")
+ else
+ add_includedirs("$(projectdir)/src/zenvfs/include", {public=true})
+ end
add_deps("robin-map")
add_packages("eastl", {public=true});