Fix daemon logging rate limiter

Based on #602 but with test fix
This commit is contained in:
Neil Booth 2018-09-23 22:19:07 +01:00
parent f3166176ce
commit 6f43910f2d
2 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ class Daemon(object):
nonlocal last_error_log, retry
now = time.time()
if now - last_error_log > 60:
last_error_time = now
last_error_log = now
self.logger.error(f'{error} Retrying occasionally...')
if retry == self.max_retry and self.failover():
retry = 0

View File

@ -487,6 +487,6 @@ async def test_failover(daemon, caplog):
with ClientSessionFailover(('getblockcount', [], height)):
await daemon.height() == height
assert in_caplog(caplog, "disconnected", 3)
assert in_caplog(caplog, "disconnected", 1)
assert in_caplog(caplog, "failing over")
assert in_caplog(caplog, "connection restored")