fix: replace blocking time.sleep with await asyncio.sleep in WhatsApp connect
time.sleep(1) inside async def connect() blocks the entire event loop for 1 second. Replaced with await asyncio.sleep(1) to yield control back to the event loop while waiting for the killed port process to release.
This commit is contained in:
parent
c754135965
commit
34f8ac2d85
1 changed files with 2 additions and 2 deletions
|
|
@ -181,8 +181,8 @@ class WhatsAppAdapter(BasePlatformAdapter):
|
||||||
|
|
||||||
# Kill any orphaned bridge from a previous gateway run
|
# Kill any orphaned bridge from a previous gateway run
|
||||||
_kill_port_process(self._bridge_port)
|
_kill_port_process(self._bridge_port)
|
||||||
import time
|
import asyncio
|
||||||
time.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
# Start the bridge process in its own process group.
|
# Start the bridge process in its own process group.
|
||||||
# Route output to a log file so QR codes, errors, and reconnection
|
# Route output to a log file so QR codes, errors, and reconnection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue