File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -393,7 +393,17 @@ async def _receive_message(self):
393393 await self ._process_message (json .loads (message ))
394394 except Exception as e :
395395 logger .error (f"WebSocket received error while receiving messages: { str (e )} " )
396- await self .reconnect ()
396+ finally :
397+ # To prevent infinite hang, we need to cancel all ongoing execution as we could lost results during the reconnect
398+ for key , execution in self ._executions .items ():
399+ await execution .queue .put (
400+ Error (
401+ name = "WebSocketError" ,
402+ value = "The connections was lost, rerun the code to get the results" ,
403+ traceback = "" ,
404+ )
405+ )
406+ await execution .queue .put (UnexpectedEndOfExecution ())
397407
398408 async def _process_message (self , data : dict ):
399409 """
You can’t perform that action at this time.
0 commit comments