Skip to content

Commit 2b0f739

Browse files
authored
Merge pull request #10443 from Icinga/use-correct-timeout-for-command-endpoints
Checkable: Use correct timeout for rescheduling remote checks
2 parents ec2080d + 0c2215a commit 2b0f739

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/icinga/checkable-check.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,16 @@ void Checkable::ExecuteCheck()
623623
if (service)
624624
params->Set("service", service->GetShortName());
625625

626+
double checkTimeout = GetCheckCommand()->GetTimeout();
627+
626628
/*
627629
* If the host/service object specifies the 'check_timeout' attribute,
628630
* forward this to the remote endpoint to limit the command execution time.
629631
*/
630-
if (!GetCheckTimeout().IsEmpty())
631-
params->Set("check_timeout", GetCheckTimeout());
632+
if (auto ckCheckTimeout(GetCheckTimeout()); !ckCheckTimeout.IsEmpty()) {
633+
checkTimeout = Convert::ToDouble(ckCheckTimeout);
634+
params->Set("check_timeout", ckCheckTimeout);
635+
}
632636

633637
params->Set("macros", macros);
634638

@@ -641,7 +645,7 @@ void Checkable::ExecuteCheck()
641645
* a check result from the remote instance. The check will be re-scheduled
642646
* using the proper check interval once we've received a check result.
643647
*/
644-
SetNextCheck(Utility::GetTime() + GetCheckCommand()->GetTimeout() + 30);
648+
SetNextCheck(Utility::GetTime() + checkTimeout + 30);
645649

646650
/*
647651
* Let the user know that there was a problem with the check if

0 commit comments

Comments
 (0)