Closed SamVerschueren closed 7 years ago
maxRestarts
is a cap to prevent rogue processes. It will automatically try to restart up to maxRestarts
times only for the first 60 seconds. The thinking behind this is if the app fails too many times within the first minute, there's likely a bug in the app and it should crash. The maxRestarts
option is just a way to provide developers control over what that limit should be.
And can you elaborate on maxRetries
then?
maxRetries
is essentially the same thing without the 60 second time limit.
maxRestarts
is useful for forcing a crash when there are programming errors, which tend to show up when a process first launches. maxRetries
is useful when a process is pretty well trusted, but encounters an unforeseen critical edge case at some point down the road. An example of this would be an API with a logic problem, as opposed to a technicality... or perhaps an API that cannot connect to another resource (such as a credit card processor or an API where your credentials have changed).
Alright. Thanks for the clear explanation! Might be worth adding to the README
as it wasn't entirely clear. At least to me it wasn't.
In the Don't DOS yourself section, I found out about
maxRetries
andmaxRestarts
.From what I understand,
maxRestarts
works in a 60 second timewindow. If this is set to3
(which is the default), it will restart 3 times per 60 seconds. Does this mean it should try to restart 3 times again the 2nd 60 seconds and again for the 3rd 60 seconds? This does not seem to work. It just tries to restart 3 times and that's it.