mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 04:43:45 +03:00
Make the UpdatesThread a daemon (closes #60)
This commit is contained in:
parent
89326c998a
commit
a7595347f3
|
@ -46,7 +46,8 @@ class MtProtoSender:
|
||||||
self.updates_thread_sleep = None
|
self.updates_thread_sleep = None
|
||||||
|
|
||||||
self.updates_thread = Thread(
|
self.updates_thread = Thread(
|
||||||
target=self.updates_thread_method, name='UpdatesThread')
|
name='UpdatesThread', daemon=True,
|
||||||
|
target=self.updates_thread_method)
|
||||||
|
|
||||||
# The "updates" thread must also be running to make periodic ping requests.
|
# The "updates" thread must also be running to make periodic ping requests.
|
||||||
self.set_updates_thread(running=True)
|
self.set_updates_thread(running=True)
|
||||||
|
@ -399,7 +400,6 @@ class MtProtoSender:
|
||||||
# Always sleep a bit before each iteration to relax the CPU,
|
# Always sleep a bit before each iteration to relax the CPU,
|
||||||
# since it's possible to early 'continue' the loop to reach
|
# since it's possible to early 'continue' the loop to reach
|
||||||
# the next iteration, but we still should to sleep.
|
# the next iteration, but we still should to sleep.
|
||||||
if self.updates_thread_running:
|
|
||||||
if self.updates_thread_sleep:
|
if self.updates_thread_sleep:
|
||||||
sleep(self.updates_thread_sleep)
|
sleep(self.updates_thread_sleep)
|
||||||
self.updates_thread_sleep = None
|
self.updates_thread_sleep = None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user