Force minimum uptime to be >= 120 seconds if a crash occurs (#2534)

This is an incremental improvement over 4a6841a5a4. This change works better because it also reduces disk spam of crashdumps.

This will now sleep if the server uptime was less than 120 seconds before crashing. If unattended, this will clamp down on automated crashdump spam. If attended, the user can simply press CTRL+C to abort the process and skip the delay.
This commit is contained in:
Dylan T
2018-11-25 14:35:35 +00:00
committed by GitHub
parent 6bc79149c3
commit d5a1961e6b

View File

@ -2247,6 +2247,12 @@ class Server{
$this->forceShutdown();
$this->isRunning = false;
//Force minimum uptime to be >= 120 seconds, to reduce the impact of spammy crash loops
$spacing = ((int) \pocketmine\START_TIME) - time() + 120;
if($spacing > 0){
sleep($spacing);
}
@Utils::kill(getmypid());
exit(1);
}