mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Don't spawn unnecessary threads when no_updates=True
This commit is contained in:
parent
2ba921c84d
commit
8681ca2043
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user