Browse Source

Call BPSmeter.init_server_stats for all servers at end of day

tags/3.3.0RC1
Safihre 4 years ago
parent
commit
3d877eed13
  1. 13
      sabnzbd/bpsmeter.py
  2. 4
      sabnzbd/downloader.py

13
sabnzbd/bpsmeter.py

@ -273,15 +273,8 @@ class BPSMeter:
if t > self.end_of_day:
# Current day passed, get new end of day
self.day_label = time.strftime("%Y-%m-%d")
self.day_total = {}
self.end_of_day = tomorrow(t) - 1.0
# Need to update all counters
for server in self.timeline_total:
self.timeline_total[server][self.day_label] = 0
for server in self.article_stats_tried:
self.article_stats_tried[server][self.day_label] = 0
self.article_stats_failed[server][self.day_label] = 0
self.day_total = {}
# Check end of week and end of month
if t > self.end_of_week:
@ -291,6 +284,10 @@ class BPSMeter:
self.month_total = {}
self.end_of_month = next_month(t) - 1.0
# Need to reset all counters
for server in sabnzbd.Downloader.servers[:]:
self.init_server_stats(server.id)
# Add amounts that have been stored temporarily to statistics
for srv in self.cached_amount:
if self.cached_amount[srv]:

4
sabnzbd/downloader.py

@ -52,6 +52,8 @@ _PENALTY_VERYSHORT = 0.1 # Error 400 without cause clues
# Wait this many seconds between checking idle servers for new articles or busy threads for timeout
_SERVER_CHECK_DELAY = 0.5
# Wait this many seconds between updates of the BPSMeter
_BPSMETER_UPDATE_DELAY = 0.05
TIMER_LOCK = RLock()
@ -694,7 +696,7 @@ class Downloader(Thread):
if now > next_bpsmeter_update:
BPSMeter.update()
next_bpsmeter_update = now + 0.05
next_bpsmeter_update = now + _BPSMETER_UPDATE_DELAY
if not read:
continue

Loading…
Cancel
Save