Skip to content

Commit 5422b54

Browse files
committed
Cleanup code a bit, move some DEBUG=True only changes into properly commented sections, remove unused variables
1 parent e41b7b4 commit 5422b54

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

nonblock/BackgroundWrite.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
'''
88
# vim: ts=4 sw=4 expandtab
99

10-
import sys
1110
import threading
1211
import time
1312

@@ -25,6 +24,8 @@
2524

2625
# Uncomment the "DEBUG" sections you want to see below. Search for DEBUG.
2726
#DEBUG = False
27+
#if DEBUG:
28+
# import sys
2829

2930

3031
def bgwrite(fileObj, data, closeWhenFinished=False, chainAfter=None, ioPrio=4):
@@ -229,8 +230,8 @@ def run(self):
229230
bandwidthPctDec = bandwidthPct / 100.0
230231

231232

232-
# Number of blocks, total
233-
numBlocks = len(self.remainingData)
233+
# Number of blocks, total (note: unused, removed)
234+
#numBlocks = len(self.remainingData)
234235
# Bytes written
235236
dataWritten = 0
236237

@@ -299,9 +300,10 @@ def run(self):
299300

300301
delta = after - before - timeSlept
301302

302-
rate = dataWritten / delta
303303

304304
# if DEBUG is True:
305+
# rate = dataWritten / delta
306+
305307
# sys.stdout.write('\t I have written %d bytes in %3.3f seconds and slept %3.3f sec (%4.5f M/s over %3.3fs)\n' %(dataWritten, delta, timeSlept, (rate) / (1024*1024), delta + timeSlept ))
306308
# sys.stdout.flush()
307309

0 commit comments

Comments
 (0)