Don't spawn unnecessary threads when no_updates=True

This commit is contained in:
Dan 2020-03-30 17:33:28 +02:00
parent 2ba921c84d
commit 8681ca2043

View File

@ -216,7 +216,7 @@ class Client(Methods, BaseClient):
else:
raise ValueError("Unknown storage engine")
self.dispatcher = Dispatcher(self, workers)
self.dispatcher = Dispatcher(self, 0 if no_updates else workers)
def __enter__(self):
return self.start()
@ -302,6 +302,7 @@ class Client(Methods, BaseClient):
self.load_plugins()
if not self.no_updates:
for i in range(self.UPDATES_WORKERS):
self.updates_workers_list.append(
Thread(
@ -355,6 +356,7 @@ class Client(Methods, BaseClient):
self.download_workers_list.clear()
if not self.no_updates:
for _ in range(self.UPDATES_WORKERS):
self.updates_queue.put(None)