Don't allow retry_interval <= 0

This commit is contained in:
Michael Friedrich 2019-01-28 17:33:05 +01:00
parent b1442645ce
commit 8cbd482072
2 changed files with 9 additions and 0 deletions

View File

@ -198,6 +198,14 @@ void Checkable::ValidateCheckInterval(const Lazy<double>& lvalue, const Validati
BOOST_THROW_EXCEPTION(ValidationError(this, { "check_interval" }, "Interval must be greater than 0."));
}
void Checkable::ValidateRetryInterval(const Lazy<double>& lvalue, const ValidationUtils& utils)
{
ObjectImpl<Checkable>::ValidateRetryInterval(lvalue, utils);
if (lvalue() <= 0)
BOOST_THROW_EXCEPTION(ValidationError(this, { "retry_interval" }, "Interval must be greater than 0."));
}
void Checkable::ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& utils)
{
ObjectImpl<Checkable>::ValidateMaxCheckAttempts(lvalue, utils);

View File

@ -192,6 +192,7 @@ public:
std::vector<intrusive_ptr<Dependency> > GetReverseDependencies() const;
void ValidateCheckInterval(const Lazy<double>& lvalue, const ValidationUtils& value) final;
void ValidateRetryInterval(const Lazy<double>& lvalue, const ValidationUtils& value) final;
void ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& value) final;
static void IncreasePendingChecks();