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

Make fromApplication call non-blocking the UI thread #94

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

denys-vasylenko
Copy link
Contributor

Offload call to the fromApplication method to IO dispatcher, so that it doesn't block UI thread when creating AppComponent.
This should help to avoid possible ANRs on low-end devices, when the component creation might also clash with GC and cause a delay.

Copy link
Collaborator

@helios66 helios66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@@ -21,9 +23,11 @@ public class WhetstoneWorkerInitializer : Initializer<WorkManager> {


private fun Whetstone.installWorkerFactory(application: Application) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random thought, non-blocking. is there merit to making this function a suspending function called in a coroutine scope? those are also non-blocking even when called on the main thread. cc @vsdeni

@denys-vasylenko denys-vasylenko merged commit 1c21c7d into main Mar 15, 2024
2 checks passed
@denys-vasylenko denys-vasylenko deleted the task/make-from-application-call-nonblocking branch March 15, 2024 13:06
msfjarvis added a commit to msfjarvis/whetstone that referenced this pull request Mar 15, 2024
* upstream/main:
  Prepare for release 0.8.0
  Revert "Prepare for release X.Y.Z"
  Prepare for release X.Y.Z
  Make fromApplication call non-blocking the UI thread (deliveryhero#94)
viakunin added a commit that referenced this pull request May 16, 2024
viakunin added a commit that referenced this pull request May 17, 2024
msfjarvis added a commit to msfjarvis/whetstone that referenced this pull request Aug 29, 2024
* 'main' of https://github.com/deliveryhero/whetstone:
  Prepare next development version 0.8.5-SNAPSHOT.
  Update sonatype credentials.
  Prepare next development version.
  Prepare for release.
  [MDEVVEL-9] Update dagger version (deliveryhero#99)
  Prepare next development version.
  Prepare for release 0.8.2.
  Revert the deliveryhero#94 (deliveryhero#98)
  Prepare next development version.
  Prepare for release 0.8.1.
  Return nulls from MultibindingWorkerFactory for non-existent Worker classes instead of throwing exceptions (deliveryhero#96)
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