-
Notifications
You must be signed in to change notification settings - Fork 2
Update main.go #1
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
base: master
Are you sure you want to change the base?
Conversation
20 is too much tries (sensitive for CPU and network); For 5 seconds we don't have enough time to fix the problem (don't flood the log);
Usually, managers set up a progressive scale. Should we do the same? The more restarts we have, the more we wait. |
Yes, but I don't understand how manage it per process/script.
If uptime of the process/script is stable (10 mins? 1 hour?), we must decrease the timer. And I think, if process/script exits with 0 (no error), we don't need to increase the timer. |
I would make it smth like this for decrementing: go func(savedRestarts int) {
var interval = func(int) time.Duration {.... }
time.Sleep(interval(savedRestarts))
if savedRestarts == restarts {
restarts --
}
}(restarts) |
You can create an array at startup and append |
@r3lgar ofc, but there's no need, you can just use any local variable as a storage in the worker func. |
@derlaft but why? It's more flexible by using restarts/waits per process/script because of one process/script can hangs all of them. This logic prevents such fuckups. |
Look at https://github.com/derlaft/r3lgar-session/blob/master/main.go#L32 All the variables declared in this block are saved between restarts |
We can add As example: we has broken script, we stoped the daemon, fix script, start daemon again, if it successfully starts the script, all is OK, continue the job as usual, if not, wait; less flood to log/stderr. Not simple but doesn't requires the configuration file for such workarounds. |
20 is too much tries (sensitive for CPU and network);
For 5 seconds we don't have enough time to fix the problem (don't flood the log);