Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup initialize/close behavior to prevent initialized? checks everywhere #2096

Open
sl0thentr0py opened this issue Aug 29, 2023 · 1 comment
Assignees

Comments

@sl0thentr0py
Copy link
Member

And perhaps we should implement a better version of close and Sentry.initialize? 馃

Specifically:

  • We don't erase hub variables, @background_worker and @session_flusher
  • Sentry.initialize? is backed by a simple boolean state that's changed by Sentry.ini and Sentry.close.

We would still need Sentry.initialize? in some places to stop some actions after the SDK is closed, but we don't need it for preventingnil value anymore, which is getting out of hand IMO.

Originally posted by @st0012 in #2084 (comment)

@st0012
Copy link
Collaborator

st0012 commented Sep 10, 2023

The eventual goal is to find a way to limit the number of Sentry.initialized? check, so I went back to related issues:

And just having this change wouldn't reduce any of those checks as we usually do Sentry.foo.bar, where as long as Sentry.foo returns nil, we'd still see the same error.

So to actually achieve the goal, we need to ensure the data flow is not interrupted after Sentry.close and just block event-sending:

  • Return nil if the SDK is not initialized at all
  • Perform the action if the SDK is initialized
  • Perform the action if the SDK is closed
    • In this case, Client should block the event sending

It'd avoid all the Sentry.initialized? checks added above issues because they're already behind other initialization checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants