Store last announce error time

This commit is contained in:
shortcutme 2018-07-16 01:36:23 +02:00
parent 0f567385a8
commit ec8b53263c
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -149,7 +149,7 @@ class SiteAnnouncer(object):
return False return False
protocol, address = tracker.split("://", 1) protocol, address = tracker.split("://", 1)
if tracker not in self.stats: if tracker not in self.stats:
self.stats[tracker] = {"status": "", "num_request": 0, "num_success": 0, "num_error": 0, "time_request": 0} self.stats[tracker] = {"status": "", "num_request": 0, "num_success": 0, "num_error": 0, "time_request": 0, "time_last_error": 0}
self.stats[tracker]["status"] = "announcing" self.stats[tracker]["status"] = "announcing"
self.stats[tracker]["time_request"] = time.time() self.stats[tracker]["time_request"] = time.time()
@ -176,6 +176,7 @@ class SiteAnnouncer(object):
self.stats[tracker]["status"] = "error" self.stats[tracker]["status"] = "error"
self.stats[tracker]["time_status"] = time.time() self.stats[tracker]["time_status"] = time.time()
self.stats[tracker]["last_error"] = str(err).decode("utf8", "ignore") self.stats[tracker]["last_error"] = str(err).decode("utf8", "ignore")
self.stats[tracker]["time_last_error"] = time.time()
self.stats[tracker]["num_error"] += 1 self.stats[tracker]["num_error"] += 1
self.updateWebsocket(tracker="error") self.updateWebsocket(tracker="error")
return False return False