summaryrefslogtreecommitdiff
path: root/src/mongo/db/process_health/fault_manager_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/process_health/fault_manager_config.h')
-rw-r--r--src/mongo/db/process_health/fault_manager_config.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/mongo/db/process_health/fault_manager_config.h b/src/mongo/db/process_health/fault_manager_config.h
index 2cf26e2f7cf..251f7c1cf7f 100644
--- a/src/mongo/db/process_health/fault_manager_config.h
+++ b/src/mongo/db/process_health/fault_manager_config.h
@@ -68,6 +68,8 @@ enum class FaultFacetType { kMock1 = 0, kMock2, kLdap, kDns };
class FaultManagerConfig {
public:
+ static auto inline constexpr kPeriodicHealthCheckInterval{Milliseconds(50)};
+
HealthObserverIntensityEnum getHealthObserverIntensity(FaultFacetType type) {
auto intensities = getHealthObserverIntensities();
switch (type) {
@@ -90,11 +92,11 @@ public:
}
Milliseconds getActiveFaultDuration() const {
- return kActiveFaultDuration;
+ return _activeFaultDuration;
}
Milliseconds getPeriodicHealthCheckInterval() const {
- return Milliseconds(50);
+ return kPeriodicHealthCheckInterval;
}
Milliseconds getPeriodicLivenessCheckInterval() const {
@@ -105,6 +107,21 @@ public:
return Seconds(300);
}
+ /** @returns true if the periodic checks are disabled for testing purposes. This is
+ * always false in production.
+ */
+ bool periodicChecksDisabledForTests() const {
+ return _periodicChecksDisabledForTests;
+ }
+
+ void disablePeriodicChecksForTests() {
+ _periodicChecksDisabledForTests = true;
+ }
+
+ void setActiveFaultDurationForTests(Milliseconds duration) {
+ _activeFaultDuration = duration;
+ }
+
protected:
// If the server persists in TransientFault for more than this duration
// it will move to the ActiveFault state and terminate.
@@ -115,6 +132,9 @@ private:
return ServerParameterSet::getGlobal()->get<HealthMonitoringIntensitiesServerParameter>(
"healthMonitoring");
}
+
+ bool _periodicChecksDisabledForTests = false;
+ Milliseconds _activeFaultDuration = kActiveFaultDuration;
};
} // namespace process_health