-
Notifications
You must be signed in to change notification settings - Fork 161
stale decetion uses retry_interval when needed #1496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+46
−9
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ccc1cc4
stale decetion uses retry_interval when needed
5ca54ab
Merge branch 'master' into fix-stale-detection-intervals
inqrphl d1cd257
add missing curl bracket, missed it while partial staging
d2a41d4
remove older check_interval based stale detection
6f4bfa8
use retry_interval when current_attempt != max_check_attempts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1050,17 +1050,48 @@ sub _check_stale_check { | |
|
|
||
| return(0) unless $obj->{'in_check_period'}; | ||
|
|
||
| # do dependencies exist | ||
| return(0) unless(scalar @{$obj->{'depends_exec'}||[]} > 0 || scalar @{$obj->{'parents'}||[]} > 0); | ||
| # stalement requirement: | ||
| # from the last check time, a next check is scheduled | ||
| # if from that next check, hypotetical second next check is scheduled as well | ||
| # if the second next check lies in the past, the service is marked stale, as it missed two planned checks | ||
|
|
||
| my $peer_key = $obj->{'peer_key'}; | ||
| my $check_interval = $obj->{'check_interval'} * $c->stash->{'pi_detail'}->{$peer_key}->{'interval_length'}; | ||
| my $retry_interval = $obj->{'retry_interval'} * $c->stash->{'pi_detail'}->{$peer_key}->{'interval_length'}; | ||
| my $max_check_attempts = $obj->{'max_check_attempts'}; | ||
| my $current_attempt = $obj->{'current_attempt'}; | ||
| my $state = $obj->{'state'}; | ||
| my $last_check = $obj->{'last_check'}; # Last time the check got an answer | ||
| # obj.next_check is refreshed, even when there hasnt been any responses for a while. | ||
| # Staleness detection is based on last_check, next_check does not help | ||
|
|
||
| my $next_planned_check = 0; | ||
| if ($state == 0) { | ||
| $next_planned_check = $last_check + $check_interval; | ||
| } | ||
| elsif ($state != 0 && $current_attempt != $max_check_attempts) { | ||
| $next_planned_check = $last_check + $check_interval; | ||
| } | ||
| else{ | ||
| $next_planned_check = $last_check + $retry_interval; | ||
| } | ||
| my $second_next_planned_check = 0; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. basically did the same logic as next_planned_check, since we cannot be sure about which interval it used on the next step. whether the next_planned_check made the state OK, not-OK , increased the current_attempt is unknown, since thruk did not hear about it. |
||
| if ($state == 0) { | ||
| $second_next_planned_check = $next_planned_check + $check_interval; | ||
| } | ||
| elsif ($state != 0 && $current_attempt != $max_check_attempts) { | ||
| $second_next_planned_check = $next_planned_check + $check_interval; | ||
|
inqrphl marked this conversation as resolved.
Outdated
|
||
| } | ||
| else{ | ||
| $second_next_planned_check = $next_planned_check + $retry_interval; | ||
|
|
||
| # wait at least twice of the normal check interval | ||
| if($obj->{'last_check'} > time() - $check_interval * 2) { | ||
| return(0); | ||
| } | ||
|
|
||
| return(0) if $second_next_planned_check > time(); | ||
|
|
||
| # did any of the parents fail? | ||
| my $worst = 0; | ||
| for my $parent (values %{$nodes}) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be the retry_interval here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah actually, I confused the logic.