Skip to content

Commit 0a43cf8

Browse files
committed
Send error only once
1 parent 55fe213 commit 0a43cf8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

template/server/messaging.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(self, in_background: bool = False):
4141
]
4242
]()
4343
self.input_accepted = False
44+
self.errored = False
4445
self.in_background = in_background
4546

4647

@@ -232,6 +233,11 @@ async def _process_message(self, data: dict):
232233
logger.debug(
233234
f"Execution {parent_msg_ig} finished execution with error: {data['content']['ename']}: {data['content']['evalue']}"
234235
)
236+
237+
if execution.errored:
238+
return
239+
240+
execution.errored = True
235241
await queue.put(
236242
Error(
237243
name=data["content"]["ename"],
@@ -295,6 +301,11 @@ async def _process_message(self, data: dict):
295301
elif data["msg_type"] == "execute_reply":
296302
if data["content"]["status"] == "error":
297303
logger.debug(f"Execution {parent_msg_ig} finished execution with error")
304+
305+
if execution.errored:
306+
return
307+
308+
execution.errored = True
298309
await queue.put(
299310
Error(
300311
name=data["content"]["ename"],

0 commit comments

Comments
 (0)