diff options
Diffstat (limited to 'src/mongo/db/process_health/progress_monitor.cpp')
-rw-r--r-- | src/mongo/db/process_health/progress_monitor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/process_health/progress_monitor.cpp b/src/mongo/db/process_health/progress_monitor.cpp index 9b461106843..d1d1ec13f47 100644 --- a/src/mongo/db/process_health/progress_monitor.cpp +++ b/src/mongo/db/process_health/progress_monitor.cpp @@ -124,11 +124,17 @@ void ProgressMonitor::progressMonitorCheck(std::function<void(std::string cause) void ProgressMonitor::_progressMonitorLoop() { Client::initThread("FaultManagerProgressMonitor"_sd, _svcCtx, nullptr); + static const int kSleepsPerInterval = 10; while (!_terminate.load()) { progressMonitorCheck(_crashCb); - sleepFor(_faultManager->getConfig().getPeriodicLivenessCheckInterval()); + const auto interval = + Microseconds(_faultManager->getConfig().getPeriodicLivenessCheckInterval()); + // Breaking up the sleeping interval to check for `_terminate` more often. + for (int i = 0; i < kSleepsPerInterval && !_terminate.load(); ++i) { + sleepFor(interval / kSleepsPerInterval); + } } } |