Skip to content

Commit a2e6a5a

Browse files
committed
Don't reconnect in the last iteration
1 parent 1950089 commit a2e6a5a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

template/server/messaging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,13 @@ async def execute(
349349
await self._ws.send(request)
350350
break
351351
except (ConnectionClosedError, WebSocketException) as e:
352-
logger.warning(
353-
f"WebSocket connection lost while sending execution request, {i + 1}. reconnecting...: {str(e)}"
354-
)
355-
await self.reconnect()
356-
357352
# Keep the last result, even if error
358353
if i < max_retries - 1:
354+
logger.warning(
355+
f"WebSocket connection lost while sending execution request, {i + 1}. reconnecting...: {str(e)}"
356+
)
357+
await self.reconnect()
358+
359359
del self._executions[message_id]
360360
message_id = str(uuid.uuid4())
361361
execution = Execution()

0 commit comments

Comments
 (0)