Skip to content
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

add maxbackoff to limit the interval between retries #1529

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion supervisor/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ def get(section, opt, *args, **kwargs):
autorestart = auto_restart(get(section, 'autorestart', 'unexpected'))
startsecs = integer(get(section, 'startsecs', 1))
startretries = integer(get(section, 'startretries', 3))
maxbackoff = integer(get(section, 'maxbackoff', 60))
stopsignal = signal_number(get(section, 'stopsignal', 'TERM'))
stopwaitsecs = integer(get(section, 'stopwaitsecs', 10))
stopasgroup = boolean(get(section, 'stopasgroup', 'false'))
Expand Down Expand Up @@ -1047,6 +1048,7 @@ def get(section, opt, *args, **kwargs):
autorestart=autorestart,
startsecs=startsecs,
startretries=startretries,
maxbackoff=maxbackoff,
uid=uid,
stdout_logfile=logfiles['stdout_logfile'],
stdout_capture_maxbytes = stdout_cmaxbytes,
Expand Down Expand Up @@ -1879,7 +1881,7 @@ def __repr__(self):
class ProcessConfig(Config):
req_param_names = [
'name', 'uid', 'command', 'directory', 'umask', 'priority',
'autostart', 'autorestart', 'startsecs', 'startretries',
'autostart', 'autorestart', 'startsecs', 'startretries', 'maxbackoff',
'stdout_logfile', 'stdout_capture_maxbytes',
'stdout_events_enabled', 'stdout_syslog',
'stdout_logfile_backups', 'stdout_logfile_maxbytes',
Expand Down
3 changes: 2 additions & 1 deletion supervisor/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ def change_state(self, new_state, expected=True):
self.state = new_state
if new_state == ProcessStates.BACKOFF:
now = time.time()
self.backoff += 1
if self.backoff < self.config.maxbackoff:
self.backoff += 1
self.delay = now + self.backoff

event_class = self.event_map.get(new_state)
Expand Down