-
Notifications
You must be signed in to change notification settings - Fork 9
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
implement crashLoopBackOff for failed processes #64
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7d56642
implement crashLoopBackOff for failed processes
jkmw 3aa8913
adjust comments
jkmw aa70ae4
Merge remote-tracking branch 'origin/master' into crashLoopBackOff
jkmw bfee0e4
make sleep interuptable
jkmw 6e7d79e
remove obsolete retry magic
jkmw 690174b
set default `maxAttempts` to 0
jkmw 5d0f373
make maxAttempts an int-pointer to handle nil-values
jkmw 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 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package proc | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// calculates the next backOff based on the current backOff | ||
func calculateNextBackOff(currBackOff, maxBackoff time.Duration) time.Duration { | ||
if currBackOff.Seconds() <= 1 { | ||
return 2 * time.Second | ||
} | ||
next := time.Duration(2*currBackOff.Seconds()) * time.Second | ||
if next.Seconds() > maxBackoff.Seconds() { | ||
return maxBackoff | ||
} | ||
return next | ||
} |
This file contains 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
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.
Also (I know from the diff that that's not new behaviour, but still) it's come to my attention that it's annoying for some users (see #62) that you cannot actually set
maxAttempts
to0
(because that counts as "not set", and will default to 3). Should we maybe think about solving this differently?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.
Sure, there are some possibilities that make sense in my opinion. But I can't decide which one is the "best":
the current method from this pr since by default I still have 3 tries if
maxAttempts
is not set. With-1
you can set infinite.maxAttempts = 0
means infinite. Against this, however, is that the behavior changes to before and that could possibly be unexpected as well. In addition, you cannot set the job to be executed only once.maxAttempts = ' actually means
0
attempts. Then infinity would still mean-1
. I think this is the nicest solution, but it is also not backward compatible.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.
I would also lean towards option 3; one thing I could (possibly) think of would be to change the
maxAttempts
type in the configuration*int
(if supported by the HCL parser), so that we could differentiate between "not set" (maxAttempts == nil
) and "explicitly set to 0" (*maxAttempts == 0
)?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.
Good idea! Done.