Skip to content

Commit

Permalink
Fix capture of last_event_id from Sentry SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimon committed Aug 14, 2024
1 parent 9228777 commit 77e3b22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apitally/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,20 @@ def capture_sentry_event_id(self, server_error: ServerError) -> None:
from sentry_sdk.scope import Scope
except ImportError:
return # pragma: no cover
if not hasattr(Scope, "get_isolation_scope") or not hasattr(Scope, "last_event_id"):
if not hasattr(Scope, "get_isolation_scope") or not hasattr(Scope, "_last_event_id"):
# sentry-sdk < 2.2.0 is not supported
return # pragma: no cover
if Hub.current.client is None:
return # sentry-sdk not initialized

scope = Scope.get_isolation_scope()
if event_id := scope.last_event_id():
if event_id := scope._last_event_id:
self.sentry_event_ids[server_error] = event_id
return

async def _wait_for_sentry_event_id(scope: Scope) -> None:
i = 0
while not (event_id := scope.last_event_id()) and i < 100:
while not (event_id := scope._last_event_id) and i < 100:
i += 1
await asyncio.sleep(0.001)
if event_id:
Expand Down

0 comments on commit 77e3b22

Please sign in to comment.