mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
fix: reconnect if stream closed (#8055)
This commit is contained in:
parent
356cd9ff9f
commit
00865fbb8a
@ -7,6 +7,7 @@ import re
|
||||
from uuid import uuid4
|
||||
|
||||
import tornado
|
||||
import tornado.websocket
|
||||
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
|
||||
from tornado.escape import json_decode, json_encode, url_escape
|
||||
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
|
||||
@ -139,7 +140,7 @@ class JupyterKernel:
|
||||
wait=wait_fixed(2),
|
||||
)
|
||||
async def execute(self, code: str, timeout: int = 120) -> str:
|
||||
if not self.ws:
|
||||
if not self.ws or self.ws.stream.closed():
|
||||
await self._connect()
|
||||
|
||||
msg_id = uuid4().hex
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user