Skip to content

Commit

Permalink
Crash when unable to communicate with server on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
sirkojon authored and Hejki committed Jan 18, 2024
1 parent 2d9ff04 commit c6472f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cumulus/rootfs/opt/cumulus/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,22 @@ def new_event_loop(self) -> asyncio.AbstractEventLoop:
return loop


def _async_loop_exception_handler(_: Any, context: dict[str, Any]) -> None:
def _async_loop_exception_handler(loop: asyncio.AbstractEventLoop, context: dict[str, Any]) -> None:
"""
Handle all exception inside the core loop.
"""

kwargs = {}
if exception := context.get("exception"):
kwargs["exc_info"] = (type(exception), exception, exception.__traceback__)

if source_traceback := context.get("source_traceback"):
stack_summary = "".join(traceback.format_list(source_traceback))
_LOGGER.error("Error doing job: %s: %s", context["message"], stack_summary, **kwargs)
loop.stop()
return

loop.stop()
_LOGGER.error("Error doing job: %s", context["message"], **kwargs)


Expand Down

0 comments on commit c6472f3

Please sign in to comment.