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

Perform root detection on a background thread #1200

Merged

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Mar 18, 2021

Goal

The implementation should detect root on a background thread when Bugsnag initialises to reduce impact on the main thread. If root detection is halfway complete when an error is captured, then the notifier will block using a Future until the root detection is complete.

Changeset

Invoked root detection on a background thread which returns a Future<Boolean>. This will execute immediately in the background, but if an error occurs before root detection can complete, the Future will block using get() until the value is available for use in the Device payload.

If the task can't be scheduled or is interrupted with an exception then false will be used as a default value. (This is a highly improbable scenarios as the executor is very unlikely to be saturated with tasks during initialization.)

Testing

Manually verified that the root detection occurs on a non-main thread.

@fractalwrench fractalwrench force-pushed the PLAT-6109/bg-root-detection branch from ea21c71 to 9d04c79 Compare March 18, 2021 15:10
@fractalwrench fractalwrench changed the base branch from next to integration/road-989-root-detection March 18, 2021 15:10
@fractalwrench fractalwrench force-pushed the PLAT-6109/bg-root-detection branch from 9d04c79 to a4d23fb Compare March 18, 2021 15:11
@fractalwrench fractalwrench marked this pull request as ready for review March 18, 2021 15:17
@fractalwrench fractalwrench merged commit 6da8367 into integration/road-989-root-detection Mar 19, 2021
@fractalwrench fractalwrench deleted the PLAT-6109/bg-root-detection branch March 19, 2021 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants