From c1eb25151f84b93e5eef6a74842476c016eceb1d Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Mon, 18 Mar 2024 11:32:54 +0100 Subject: 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 --- src/zenserver/main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/zenserver/main.cpp') 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); -- cgit v1.2.3