Skip to content

Commit 82e131b

Browse files
committed
Actor: Don't restart on RuntimeError:No Running Eventloop
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 7db59ae commit 82e131b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/frequenz/sdk/actor/_actor.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,16 @@ async def _run_loop(self) -> None:
104104
except asyncio.CancelledError:
105105
_logger.info("Actor %s: Cancelled.", self)
106106
raise
107-
except Exception: # pylint: disable=broad-except
107+
except Exception as exc: # pylint: disable=broad-except
108+
if isinstance(exc, RuntimeError) and "no running event loop" in str(
109+
exc
110+
):
111+
_logger.exception(
112+
"Something went wrong, no running event loop,"
113+
" not trying to restart %s again.",
114+
self,
115+
)
116+
break
108117
if self._is_cancelled:
109118
# If actor was cancelled, but any tasks have failed with an exception
110119
# other than asyncio.CancelledError, those exceptions are combined

0 commit comments

Comments
 (0)