From 1d22e84f21eee9257dfad7c0fe76441f1f589a9d Mon Sep 17 00:00:00 2001 From: CyberKitsune Date: Mon, 31 Aug 2020 22:10:57 -0700 Subject: [PATCH] Allow a stale value on startup for disk size if the disk is unlimited. --- server/power.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/power.go b/server/power.go index 36e802c..7435c2c 100644 --- a/server/power.go +++ b/server/power.go @@ -141,9 +141,15 @@ func (s *Server) onBeforeStart() error { // and process resource limits are correctly applied. s.SyncWithEnvironment() - s.PublishConsoleOutputFromDaemon("Checking server disk space usage, this could take a few seconds...") - if !s.Filesystem.HasSpaceAvailable(false) { - return errors.New("cannot start server, not enough disk space available") + // If a server has unlimited disk space, we don't care enough to block the startup to check remaining. + // However, we should trigger a size anyway, as it'd be good to kick it off for other processes. + if s.DiskSpace() <= 0 { + s.Filesystem.HasSpaceAvailable(true) + } else { + s.PublishConsoleOutputFromDaemon("Checking server disk space usage, this could take a few seconds...") + if !s.Filesystem.HasSpaceAvailable(false) { + return errors.New("cannot start server, not enough disk space available") + } } // Update the configuration files defined for the server before beginning the boot process.