mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Periodically check disk space to avoid corruption
This commit is contained in:
parent
7fe537f7a4
commit
ed52e71176
1 changed files with 9 additions and 0 deletions
|
@ -1159,6 +1159,15 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
RandAddPeriodic();
|
||||
}, std::chrono::minutes{1});
|
||||
|
||||
// Check disk space every 5 minutes to avoid db corruption.
|
||||
node.scheduler->scheduleEvery([&args]{
|
||||
constexpr uint64_t min_disk_space = 50 << 20; // 50 MB
|
||||
if (!CheckDiskSpace(args.GetBlocksDirPath(), min_disk_space)) {
|
||||
LogPrintf("Shutting down due to lack of disk space!\n");
|
||||
StartShutdown();
|
||||
}
|
||||
}, std::chrono::minutes{5});
|
||||
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler);
|
||||
|
||||
// Create client interfaces for wallets that are supposed to be loaded
|
||||
|
|
Loading…
Add table
Reference in a new issue