trying some adjustments to make it more responsive to ratty comms
This commit is contained in:
parent
e80b23e036
commit
0b8a7b89d2
1 changed files with 3 additions and 4 deletions
|
@ -110,22 +110,21 @@ class SlowFile:
|
||||||
# we're early
|
# we're early
|
||||||
sleepfor = self.lastblocktargettime - starttime
|
sleepfor = self.lastblocktargettime - starttime
|
||||||
time.sleep(sleepfor)
|
time.sleep(sleepfor)
|
||||||
if self.delayfactor > 1:
|
|
||||||
self.delayfactor -= 0.02
|
|
||||||
else:
|
else:
|
||||||
# we're late; something got slow.
|
# we're late; something got slow.
|
||||||
self.delayfactor += 0.5
|
self.delayfactor += 0.5
|
||||||
|
|
||||||
if self.delayfactor < 1:
|
if self.delayfactor < 1:
|
||||||
self.delayfactor = 1
|
self.delayfactor = 1
|
||||||
if self.delayfactor > 5:
|
if self.delayfactor > 20:
|
||||||
self.delayfactor = 5
|
self.delayfactor = 20
|
||||||
|
|
||||||
targetspeed = self.speed/float(self.delayfactor)
|
targetspeed = self.speed/float(self.delayfactor)
|
||||||
self.lastblocktargettime = time.time() + len/float(targetspeed)
|
self.lastblocktargettime = time.time() + len/float(targetspeed)
|
||||||
|
|
||||||
if time.time() > self.lastdebug+300:
|
if time.time() > self.lastdebug+300:
|
||||||
logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len))
|
logger.debug('Target %i bytes/second (%i kilobits/second), delay factor %.2f, block len %i' % (targetspeed, targetspeed*8/1024, self.delayfactor, len))
|
||||||
|
self.delayfactor = self.delayfactor / 2
|
||||||
try:
|
try:
|
||||||
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline())
|
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline())
|
||||||
newspeed = int((newkbits/float(8))*1024)
|
newspeed = int((newkbits/float(8))*1024)
|
||||||
|
|
Loading…
Reference in a new issue