From ae3bcbb99b0a3e75a2bd6229fcf7fc9a802d1880 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 31 Mar 2022 00:22:36 +0200 Subject: [PATCH] Fix logs space check --- programs/server/Server.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index fca5b39d2da..c12abda9594 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -583,23 +583,24 @@ static void sanityChecks(Server * server) if (getBlockDeviceType(dev_id) == BlockDeviceType::ROT && getBlockDeviceReadAheadBytes(dev_id) == 0) server->context()->addWarningMessage("Rotational disk with disabled readahead is in use. Performance can be degraded."); #endif + try { if (getAvailableMemoryAmount() < (2l << 30)) server->context()->addWarningMessage("Available memory at server startup is too low (2GiB)."); + + if (!enoughSpaceInDirectory(data_path, 1ull << 30)) + server->context()->addWarningMessage("Available disk space at server startup is too low (1GiB)."); + + if (!logs_path.empty()) + { + if (!enoughSpaceInDirectory(fs::path(logs_path).parent_path(), 1ull << 30)) + server->context()->addWarningMessage("Available disk space at server startup is too low (1GiB)."); + } } catch (...) { } - - if (!enoughSpaceInDirectory(data_path, 1ull << 30)) - server->context()->addWarningMessage("Available disk space at server startup is too low (1GiB)."); - - if (!logs_path.empty()) - { - if (!enoughSpaceInDirectory(logs_path, 1ull << 30)) - server->context()->addWarningMessage("Available disk space at server startup is too low (1GiB)."); - } } int Server::main(const std::vector & /*args*/)