update refactoring and add new features
This commit is contained in:
@@ -319,7 +319,7 @@ class Telegram(Provider):
|
||||
def _run_async_blocking(self, coro):
|
||||
"""Run an awaitable to completion using a fresh event loop.
|
||||
|
||||
If an event loop is already running in this thread (common in REPL/TUI),
|
||||
If an event loop is already running in this thread (common in REPL),
|
||||
runs the coroutine in a worker thread with its own loop.
|
||||
"""
|
||||
result: Dict[str,
|
||||
@@ -358,6 +358,13 @@ class Telegram(Provider):
|
||||
except Exception:
|
||||
pass
|
||||
finally:
|
||||
try:
|
||||
try:
|
||||
loop.run_until_complete(loop.shutdown_default_executor())
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
loop.close()
|
||||
except Exception:
|
||||
@@ -559,6 +566,10 @@ class Telegram(Provider):
|
||||
asyncio.set_event_loop(loop)
|
||||
loop.run_until_complete(_auth_async())
|
||||
finally:
|
||||
try:
|
||||
loop.run_until_complete(loop.shutdown_default_executor())
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
loop.close()
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user