feat: revive relay after 24 hours from the last error

This commit is contained in:
Vlad Stan 2023-06-30 10:52:16 +03:00
parent ada5b2a51d
commit 39c2f881c8
2 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import ssl
import threading
import time
from loguru import logger
@ -97,7 +98,12 @@ class RelayManager:
def _restart_relay(self, relay: Relay):
if relay.error_threshold_reached:
return
time_since_last_error = time.time() - relay.last_error_date
if time_since_last_error < 60 * 60 * 24: # last day
return
relay.error_counter = 0
relay.error_list = []
logger.info(f"Restarting connection to relay '{relay.url}'")
self.remove_relay(relay.url)