mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
Rename worker to net_worker
This commit is contained in:
parent
00631fcc33
commit
f8688cd260
@ -157,7 +157,7 @@ class Client:
|
|||||||
self.proxy,
|
self.proxy,
|
||||||
self.auth_key,
|
self.auth_key,
|
||||||
self.config.api_id,
|
self.config.api_id,
|
||||||
workers=self.workers
|
net_workers=self.workers
|
||||||
)
|
)
|
||||||
|
|
||||||
terms = self.session.start()
|
terms = self.session.start()
|
||||||
@ -263,7 +263,7 @@ class Client:
|
|||||||
self.proxy,
|
self.proxy,
|
||||||
self.auth_key,
|
self.auth_key,
|
||||||
self.config.api_id,
|
self.config.api_id,
|
||||||
workers=self.workers
|
net_workers=self.workers
|
||||||
)
|
)
|
||||||
self.session.start()
|
self.session.start()
|
||||||
|
|
||||||
|
@ -75,14 +75,14 @@ class Session:
|
|||||||
auth_key: bytes,
|
auth_key: bytes,
|
||||||
api_id: str,
|
api_id: str,
|
||||||
is_cdn: bool = False,
|
is_cdn: bool = False,
|
||||||
workers: int = 2):
|
net_workers: int = 2):
|
||||||
if not Session.notice_displayed:
|
if not Session.notice_displayed:
|
||||||
print("Pyrogram v{}, {}".format(__version__, __copyright__))
|
print("Pyrogram v{}, {}".format(__version__, __copyright__))
|
||||||
print("Licensed under the terms of the " + __license__, end="\n\n")
|
print("Licensed under the terms of the " + __license__, end="\n\n")
|
||||||
Session.notice_displayed = True
|
Session.notice_displayed = True
|
||||||
|
|
||||||
self.is_cdn = is_cdn
|
self.is_cdn = is_cdn
|
||||||
self.workers = workers
|
self.net_workers = net_workers
|
||||||
|
|
||||||
self.connection = Connection(DataCenter(dc_id, test_mode), proxy)
|
self.connection = Connection(DataCenter(dc_id, test_mode), proxy)
|
||||||
|
|
||||||
@ -124,8 +124,8 @@ class Session:
|
|||||||
try:
|
try:
|
||||||
self.connection.connect()
|
self.connection.connect()
|
||||||
|
|
||||||
for i in range(self.workers):
|
for i in range(self.net_workers):
|
||||||
Thread(target=self.worker, name="Worker#{}".format(i + 1)).start()
|
Thread(target=self.net_worker, name="NetWorker#{}".format(i + 1)).start()
|
||||||
|
|
||||||
Thread(target=self.recv, name="RecvThread").start()
|
Thread(target=self.recv, name="RecvThread").start()
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class Session:
|
|||||||
|
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
|
|
||||||
for i in range(self.workers):
|
for i in range(self.net_workers):
|
||||||
self.recv_queue.put(None)
|
self.recv_queue.put(None)
|
||||||
|
|
||||||
log.debug("Session stopped")
|
log.debug("Session stopped")
|
||||||
@ -232,7 +232,7 @@ class Session:
|
|||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
def worker(self):
|
def net_worker(self):
|
||||||
name = threading.current_thread().name
|
name = threading.current_thread().name
|
||||||
log.debug("{} started".format(name))
|
log.debug("{} started".format(name))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user