aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/main.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-03-18 11:32:54 +0100
committerGitHub Enterprise <[email protected]>2024-03-18 11:32:54 +0100
commitc1eb25151f84b93e5eef6a74842476c016eceb1d (patch)
tree15b8c4b0ed8b4d9e57b5307cb368bf646e0a56ea /src/zenserver/main.cpp
parentmake sure zenserver reacts and exist on SIGTERM signal (#8) (diff)
downloadzen-c1eb25151f84b93e5eef6a74842476c016eceb1d.tar.xz
zen-c1eb25151f84b93e5eef6a74842476c016eceb1d.zip
add a retry when trying to create the lock file (#9)
* add a retry when trying to create the lock file if UE is trying to read it at the same time
Diffstat (limited to 'src/zenserver/main.cpp')
-rw-r--r--src/zenserver/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp
index 01e142801..b4cb2464b 100644
--- a/src/zenserver/main.cpp
+++ b/src/zenserver/main.cpp
@@ -145,9 +145,15 @@ ZenEntryPoint::Run()
if (Ec)
{
- ZEN_WARN("ERROR: Unable to grab lock at '{}' (error: '{}')", LockFilePath, Ec.message());
+ ZEN_WARN("Unable to grab lock at '{}' (error: '{}'), retrying", LockFilePath, Ec.message());
+ Sleep(500);
- std::exit(99);
+ m_LockFile.Create(LockFilePath, MakeLockData(), Ec);
+ if (Ec)
+ {
+ ZEN_WARN("ERROR: Unable to grab lock at '{}' (error: '{}')", LockFilePath, Ec.message());
+ std::exit(99);
+ }
}
InitializeServerLogging(m_ServerOptions);