aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-10-06 13:31:08 +0200
committerGitHub <[email protected]>2023-10-06 13:31:08 +0200
commit49428e56261ace28cdabee10e354d7a08850727c (patch)
tree2ed1ce1a3c086745d1dfead36b2052413fa6e9b7 /src/zenserver/projectstore/projectstore.cpp
parentzenserver project restructuring (#442) (diff)
downloadzen-49428e56261ace28cdabee10e354d7a08850727c.tar.xz
zen-49428e56261ace28cdabee10e354d7a08850727c.zip
fix gc infinite loop (#453)
* make sure we update last gc time even if gc fails * If we can't check if an oplog/project markerfile exists, assume it is not expired
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 4402e4486..e000976ea 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1580,12 +1580,20 @@ bool
ProjectStore::Project::IsExpired(const RwLock::SharedLockScope&,
const std::string& EntryName,
const std::filesystem::path& MarkerPath,
- const GcClock::TimePoint ExpireTime) const
+ const GcClock::TimePoint ExpireTime)
{
if (!MarkerPath.empty())
{
- if (std::filesystem::exists(MarkerPath))
+ std::error_code Ec;
+ if (std::filesystem::exists(MarkerPath, Ec))
{
+ if (Ec)
+ {
+ ZEN_WARN("Failed to check expiry via marker file '{}', assuming {} is not expired",
+ EntryName.empty() ? "project" : EntryName,
+ MarkerPath.string());
+ return false;
+ }
return false;
}
}
@@ -1603,7 +1611,7 @@ ProjectStore::Project::IsExpired(const RwLock::SharedLockScope&,
}
bool
-ProjectStore::Project::IsExpired(const RwLock::SharedLockScope& ProjectLock, const GcClock::TimePoint ExpireTime) const
+ProjectStore::Project::IsExpired(const RwLock::SharedLockScope& ProjectLock, const GcClock::TimePoint ExpireTime)
{
return IsExpired(ProjectLock, std::string(), ProjectFilePath, ExpireTime);
}
@@ -1611,13 +1619,13 @@ ProjectStore::Project::IsExpired(const RwLock::SharedLockScope& ProjectLock, con
bool
ProjectStore::Project::IsExpired(const RwLock::SharedLockScope& ProjectLock,
const GcClock::TimePoint ExpireTime,
- const ProjectStore::Oplog& Oplog) const
+ const ProjectStore::Oplog& Oplog)
{
return IsExpired(ProjectLock, Oplog.OplogId(), Oplog.MarkerPath(), ExpireTime);
}
bool
-ProjectStore::Project::IsExpired(const GcClock::TimePoint ExpireTime, const ProjectStore::Oplog& Oplog) const
+ProjectStore::Project::IsExpired(const GcClock::TimePoint ExpireTime, const ProjectStore::Oplog& Oplog)
{
RwLock::SharedLockScope Lock(m_ProjectLock);
return IsExpired(Lock, Oplog.OplogId(), Oplog.MarkerPath(), ExpireTime);