improve postpone checks outside of check period #494
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
with #490 we rescheduled checks found outside their check period to the next time slot in their check period with a random delay of 60 seconds (or what ever retained_scheduling_randomize_window was set to)
There are 2 scenarios when this leads to scheduling issues:
timeperiod. Those checks should evenly be scheduled over the 2h interval
but currently, they would start with the office hours and from then they
all at once every 2 hours which results in load peaks.
The solution here is to take the check period into account when postponing
the next check.
ex.: only 08:00 till 08:05. In this case we need to take the actual time slot
into account to find a valid next check time slot.
While on it, i merged the code into a generic function which is then used for hosts and services.