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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fast path for ignoring errors #1737

Merged
merged 2 commits into from
Jun 4, 2024
Merged

Conversation

stayallive
Copy link
Collaborator

This change makes the ErrorHandler aware of the SDK options in default operations and allows it to take a fast path and ignore errors without doing any work instead of building up a error exception and discarding it in the ErrorListenerIntegration. If a lot of errors are being ignored this can end up saving a some time and wasted CPU cycles.

This should be completely backwards compatible and if anyone uses the ErrorHandler directly they should not see any improvement nor any negative effect nor need to change their code. But if the ErrorHandler is managed by the SDK it will become Options aware and allow to take the fast path.

There are intentionally no tests since this change only should affect performance and has no effect on the outcome or operation of the SDK. Either shouldHandleError or the two if cases in the ErrorHandler can be removed without any failing tests and having both also leaves all tests intact proving we still handle and ignore the same errors as before just with slightly improved performance now.

Fixes #1736.

@stayallive stayallive merged commit 9af5037 into master Jun 4, 2024
31 checks passed
@stayallive stayallive deleted the optimize-error-handler branch June 4, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

\Sentry\ErrorHandler::handleError slow performance when notices thrown
2 participants