mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Only share trackers with success in last hour
This commit is contained in:
parent
767ec1795a
commit
7a3dbf626e
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ class TrackerStorage(object):
|
|||
trackers[tracker_address]["time_error"] = time.time()
|
||||
trackers[tracker_address]["num_error"] += 1
|
||||
|
||||
if trackers[tracker_address]["num_error"] > 30 and trackers[tracker_address]["time_success"] < time.time() - 60 * 60 * 24:
|
||||
if trackers[tracker_address]["num_error"] > 30 and trackers[tracker_address]["time_success"] < time.time() - 60 * 60:
|
||||
self.log.debug("Tracker %s looks down, removing." % tracker_address)
|
||||
del trackers[tracker_address]
|
||||
|
||||
|
@ -70,7 +70,7 @@ class TrackerStorage(object):
|
|||
def getWorkingTrackers(self, type):
|
||||
trackers = {
|
||||
key: tracker for key, tracker in self.getTrackers(type).iteritems()
|
||||
if tracker["time_success"] > time.time() - 60 * 60 * 24
|
||||
if tracker["time_success"] > time.time() - 60 * 60
|
||||
}
|
||||
return trackers
|
||||
|
||||
|
|
Loading…
Reference in a new issue