def DownloadThrottlerThread(self):
while self.threadRun:
time.sleep(self.updateTime)
tot_down_size_KB = float(sum(self.DOWNLOAD_RATE_LIMIT_BUFFER)/1024.0)
download_speed_limit_KBps = float(Prefs['download_speed_limit'])
if tot_down_size_KB > 0 and download_speed_limit_KBps > 0:
tot_down_speed_KBps = round(float(tot_down_size_KB/self.updateTime), 3)
if Prefs['use_debug']:
Log('Download Throttler:---> Timestamp:%s | Total Down Speed: %s KB/s | Speed Limit: %s KB/s' % (time.time(), tot_down_speed_KBps, download_speed_limit_KBps))
if tot_down_speed_KBps > download_speed_limit_KBps:
self.throttle = True
self.throttleStateSleepTime = round(tot_down_speed_KBps/download_speed_limit_KBps,3)
if Prefs['use_debug']:
Log("Download Throttler:---> Sleep for %s sec." % self.throttleStateSleepTime)
time.sleep(self.throttleStateSleepTime)
self.reset()
评论列表
文章目录