Use socket logic to determine proper number of threads for upload

This commit is contained in:
Matt Martz 2014-03-10 12:19:08 -05:00
parent 0e7160e8e6
commit 6888a5aae1
1 changed files with 3 additions and 1 deletions

View File

@ -808,6 +808,8 @@ class Speedtest(object):
cons_thread.join(timeout=0.1)
self._results.download = (sum(finished) / (time.time() - start))
if self._results.download > 100000:
self.config['threads']['upload'] = 8
return self._results.download
def upload(self, callback=None):
@ -843,7 +845,7 @@ class Speedtest(object):
callback(thread.i, size_count, end=True)
del thread
q = Queue(6)
q = Queue(self.config['threads']['upload'])
prod_thread = threading.Thread(target=producer,
args=(q, sizes, size_count))
cons_thread = threading.Thread(target=consumer, args=(q, size_count))