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

@ -41,6 +41,8 @@ class Relay:
self.error_counter: int = 0
self.error_threshold: int = 100
self.error_list: List[str] = []
self.notice_list: List[str] = []
self.last_error_date: int = 0
self.num_received_events: int = 0
self.num_sent_events: int = 0
self.num_subscriptions: int = 0
@ -77,7 +79,7 @@ class Relay:
@property
def error_threshold_reached(self):
return self.error_threshold and self.error_counter > self.error_threshold
return self.error_threshold and self.error_counter >= self.error_threshold
@property
def ping(self):
@ -212,4 +214,5 @@ class Relay:
return True
def _append_error_message(self, message):
self.error_list = ([message] + self.error_list)[:20]
self.error_list = ([message] + self.error_list)[:20]
self.last_error_date = int(time.time())