Browse Source

Fix daemon logging rate limiter

Based on #602 but with test fix
patch-2
Neil Booth 6 years ago
parent
commit
6f43910f2d
  1. 2
      electrumx/server/daemon.py
  2. 2
      tests/server/test_daemon.py

2
electrumx/server/daemon.py

@ -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

2
tests/server/test_daemon.py

@ -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")

Loading…
Cancel
Save