From ed158f8a1b0cfe334ac5f45febc0f633602014f2 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 29 Apr 2024 16:36:14 +0100 Subject: [PATCH] Server: include uptime in crash restart throttle message this makes it clearer why the wait duration is chosen instead of it looking random. --- src/Server.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Server.php b/src/Server.php index ed7f52d63..a34349bb5 100644 --- a/src/Server.php +++ b/src/Server.php @@ -1666,9 +1666,11 @@ class Server{ $this->isRunning = false; //Force minimum uptime to be >= 120 seconds, to reduce the impact of spammy crash loops - $spacing = ((int) $this->startTime) - time() + 120; + $uptime = time() - ((int) $this->startTime); + $minUptime = 120; + $spacing = $minUptime - $uptime; if($spacing > 0){ - echo "--- Waiting $spacing seconds to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL; + echo "--- Uptime {$uptime}s - waiting {$spacing}s to throttle automatic restart (you can kill the process safely now) ---" . PHP_EOL; sleep($spacing); } @Process::kill(Process::pid());