Skip to content

Commit

Permalink
No executor task in sentry call when not initialized (#5703)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdegat01 authored Mar 1, 2025
1 parent d42ec12 commit 5b18fb6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions supervisor/utils/sentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ async def async_capture_event(event: dict[str, Any], only_once: str | None = Non
Safe to call from event loop.
"""
await asyncio.get_running_loop().run_in_executor(
None, capture_event, event, only_once
)
if sentry_sdk.is_initialized():
await asyncio.get_running_loop().run_in_executor(
None, capture_event, event, only_once
)


def capture_exception(err: Exception) -> None:
Expand All @@ -81,7 +82,10 @@ async def async_capture_exception(err: Exception) -> None:
Safe to call in event loop.
"""
await asyncio.get_running_loop().run_in_executor(None, capture_exception, err)
if sentry_sdk.is_initialized():
await asyncio.get_running_loop().run_in_executor(
None, sentry_sdk.capture_exception, err
)


def close_sentry() -> None:
Expand Down

0 comments on commit 5b18fb6

Please sign in to comment.