Commit 7b948ac6 authored by Vincent Pelletier's avatar Vincent Pelletier

cli.updater: Prevent immediate wake-ups.

Always wait at least 60 seconds between consecutive wake-ups. Avoids
spamming server and local logs with attempts in case of temporary issues
(ex: network).
parent d387cfa0
...@@ -792,6 +792,7 @@ def updater(argv=None, until=utils.until): ...@@ -792,6 +792,7 @@ def updater(argv=None, until=utils.until):
threshold = datetime.timedelta(args.threshold, 0) threshold = datetime.timedelta(args.threshold, 0)
crl_threshold = datetime.timedelta(args.crl_threshold, 0) crl_threshold = datetime.timedelta(args.crl_threshold, 0)
max_sleep = datetime.timedelta(args.max_sleep, 0) max_sleep = datetime.timedelta(args.max_sleep, 0)
min_sleep = datetime.timedelta(0, 60)
updated = RetryingCaucaseClient.updateCAFile( updated = RetryingCaucaseClient.updateCAFile(
cas_url, cas_url,
args.cas_ca, args.cas_ca,
...@@ -892,6 +893,10 @@ def updater(argv=None, until=utils.until): ...@@ -892,6 +893,10 @@ def updater(argv=None, until=utils.until):
next_deadline, next_deadline,
crt.not_valid_after - threshold, crt.not_valid_after - threshold,
) )
next_deadline = max(
next_deadline,
now + min_sleep,
)
if updated: if updated:
if args.on_renew is not None: if args.on_renew is not None:
status = os.system(args.on_renew) status = os.system(args.on_renew)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment