mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-24 21:36:06 +00:00
fix(dingtalk): avoid blocking event loop on connection open (#2337)
This commit is contained in:
@@ -885,7 +885,10 @@ class DingTalkClient:
|
|||||||
|
|
||||||
while not self._stopped:
|
while not self._stopped:
|
||||||
try:
|
try:
|
||||||
connection = self.client.open_connection()
|
# open_connection performs blocking network I/O in the DingTalk SDK.
|
||||||
|
# Run it off the event loop so connection stalls do not block the
|
||||||
|
# LangBot HTTP server and other async tasks.
|
||||||
|
connection = await asyncio.to_thread(self.client.open_connection)
|
||||||
|
|
||||||
if not connection:
|
if not connection:
|
||||||
if self.logger:
|
if self.logger:
|
||||||
|
|||||||
Reference in New Issue
Block a user