Fix tracker statistics
This commit is contained in:
parent
329e885da7
commit
3de13a2e6d
|
@ -67,6 +67,8 @@ class SiteAnnouncer(object):
|
|||
def announce(self, force=False, mode="start", pex=True):
|
||||
if time.time() < self.time_last_announce + 30 and not force:
|
||||
return # No reannouncing within 30 secs
|
||||
if force:
|
||||
self.site.log.debug("Force reannounce in mode %s" % mode)
|
||||
|
||||
self.fileserver_port = config.fileserver_port
|
||||
self.time_last_announce = time.time()
|
||||
|
@ -111,10 +113,11 @@ class SiteAnnouncer(object):
|
|||
announced_to = trackers[0]
|
||||
else:
|
||||
announced_to = "%s/%s trackers" % (num_announced, len(threads))
|
||||
self.site.log.debug(
|
||||
"Announced in mode %s to %s in %.3fs, errors: %s, slow: %s" %
|
||||
(mode, announced_to, time.time() - s, errors, slow)
|
||||
)
|
||||
if mode != "update" or config.verbose:
|
||||
self.site.log.debug(
|
||||
"Announced in mode %s to %s in %.3fs, errors: %s, slow: %s" %
|
||||
(mode, announced_to, time.time() - s, errors, slow)
|
||||
)
|
||||
else:
|
||||
if len(threads) > 1:
|
||||
self.site.log.error("Announce to %s trackers in %.3fs, failed" % (num_announced, time.time() - s))
|
||||
|
@ -146,7 +149,7 @@ class SiteAnnouncer(object):
|
|||
self.stats[tracker] = {"status": "", "num_request": 0, "num_success": 0, "num_error": 0, "time_request": 0}
|
||||
|
||||
self.stats[tracker]["status"] = "announcing"
|
||||
self.stats[tracker]["time_status"] = time.time()
|
||||
self.stats[tracker]["time_request"] = time.time()
|
||||
self.stats[tracker]["num_request"] += 1
|
||||
if config.verbose:
|
||||
self.site.log.debug("Tracker announcing to %s (mode: %s)" % (tracker, mode))
|
||||
|
@ -177,7 +180,6 @@ class SiteAnnouncer(object):
|
|||
self.stats[tracker]["status"] = "announced"
|
||||
self.stats[tracker]["time_status"] = time.time()
|
||||
self.stats[tracker]["num_success"] += 1
|
||||
self.updateWebsocket(tracker="success")
|
||||
|
||||
if peers is None: # No peers returned
|
||||
return time.time() - s
|
||||
|
|
Loading…
Reference in New Issue