fixing hardcoded path (wow...)
This commit is contained in:
parent
6360655bf8
commit
45360b0b1a
2 changed files with 15 additions and 13 deletions
|
@ -11,6 +11,7 @@
|
||||||
# accesskey = 'amazon aws access key'
|
# accesskey = 'amazon aws access key'
|
||||||
# sharedkey = 'amazon aws shared key'
|
# sharedkey = 'amazon aws shared key'
|
||||||
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
|
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
|
||||||
|
# speedfile = '/path/to/a/speed-limit-file'
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import glob
|
import glob
|
||||||
|
@ -141,8 +142,9 @@ class SlowFile:
|
||||||
|
|
||||||
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))
|
||||||
|
|
||||||
|
if hasattr(secrets, 'speedfile'):
|
||||||
try:
|
try:
|
||||||
newkbits = int(open('/home/rtucker/Dropbox/Semaphores/BackupPC_archiveHost_s3.maxspeed', 'r').readline())
|
newkbits = int(open(secrets.speedfile, 'r').readline())
|
||||||
newspeed = int((newkbits/float(8))*1024)
|
newspeed = int((newkbits/float(8))*1024)
|
||||||
if newspeed != self.speed:
|
if newspeed != self.speed:
|
||||||
self.delayfactor = 1
|
self.delayfactor = 1
|
||||||
|
@ -150,7 +152,7 @@ class SlowFile:
|
||||||
logger.debug('Setting new speed! %i bytes/second' % newspeed)
|
logger.debug('Setting new speed! %i bytes/second' % newspeed)
|
||||||
self.lastblocktargettime = 0
|
self.lastblocktargettime = 0
|
||||||
except IOError:
|
except IOError:
|
||||||
logger.debug('No Semaphore file for new speed')
|
logger.debug('IO Error opening semaphore file')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logger.debug('Semaphore file invalid')
|
logger.debug('Semaphore file invalid')
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
# accesskey = 'amazon aws access key'
|
# accesskey = 'amazon aws access key'
|
||||||
# sharedkey = 'amazon aws shared key'
|
# sharedkey = 'amazon aws shared key'
|
||||||
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
|
# gpgsymmetrickey = 'gpg symmetric key -- make it good, but do not lose it'
|
||||||
|
# speedfile = 'path to a file that has a max upload speed in kbits/sec'
|
||||||
|
|
Loading…
Reference in a new issue