Skip to content

Commit 94b8efe

Browse files
committed
Catch & log exceptions on actor startup
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 484c90b commit 94b8efe

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/frequenz/dispatch/_actor_dispatcher.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,23 @@ async def _start_actor(self, dispatch: Dispatch) -> None:
187187
sent_str,
188188
)
189189
else:
190-
_logger.info("Starting actor for dispatch type %r", dispatch.type)
191-
actor = self._actor_factory(
192-
dispatch_update,
193-
self._updates_channel.new_receiver(limit=1, warn_on_overflow=False),
194-
)
195-
self._actors[self._dispatch_identity(dispatch)] = actor
196-
197-
actor.start()
190+
try:
191+
_logger.info("Starting actor for dispatch type %r", dispatch.type)
192+
actor = self._actor_factory(
193+
dispatch_update,
194+
self._updates_channel.new_receiver(limit=1, warn_on_overflow=False),
195+
)
196+
self._actors[self._dispatch_identity(dispatch)] = actor
197+
198+
actor.start()
199+
200+
except Exception as e: # pylint: disable=broad-except
201+
_logger.error(
202+
"Failed to start actor for dispatch type %r: %s",
203+
dispatch.type,
204+
e,
205+
exc_info=True,
206+
)
198207

199208
async def _stop_actor(self, stopping_dispatch: Dispatch, msg: str) -> None:
200209
"""Stop all actors.

0 commit comments

Comments
 (0)