We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a5a422 commit 9bd8b7aCopy full SHA for 9bd8b7a
tests/rpc/test_rpc_telegram.py
@@ -78,18 +78,18 @@ def update():
78
79
80
def patch_eventloop_threading(telegrambot):
81
- is_init = False
+ init_event = threading.Event()
82
83
def thread_fuck():
84
- nonlocal is_init
85
telegrambot._loop = asyncio.new_event_loop()
86
- is_init = True
+ init_event.set()
87
telegrambot._loop.run_forever()
88
89
x = threading.Thread(target=thread_fuck, daemon=True)
90
x.start()
91
- while not is_init:
92
- pass
+ # Wait for thread to be properly initialized with timeout
+ if not init_event.wait(timeout=5.0):
+ raise RuntimeError("Failed to initialize event loop thread")
93
94
95
class DummyCls(Telegram):
0 commit comments