Commit 0c91a324 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Vincent Pelletier

cli: Provide next try time on network error

Just like other places in caucase-updater, print the next time of wake up.
This information is useful in logs, for debugging caucase-updater problems.

/reviewed-on nexedi/caucase!6
parent 561f0af1
......@@ -74,14 +74,16 @@ class RetryingCaucaseClient(CaucaseClient):
connection.close() # Resets HTTPConnection state machine.
# Note: repr(str(exception)) is nicer than repr(exception), without
# letting non-printable characters through.
next_try = datetime.datetime.utcnow() + datetime.timedelta(0, 10)
print(
'Got a network error, retrying in a bit: %s: %r' % (
'Got a network error, retrying at %s, %s: %r' % (
next_try.strftime(b'%Y-%m-%d %H:%M:%S +0000'),
exception.__class__.__name__,
str(exception),
),
file=self._log_file,
)
self._until(datetime.datetime.utcnow() + datetime.timedelta(0, 10))
self._until(next_try)
_cryptography_backend = default_backend()
......
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