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

Fix ANR in DuckPlayerLocalFilesPath #5340

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

CrisBarreiro
Copy link
Contributor

@CrisBarreiro CrisBarreiro commented Dec 3, 2024

Task/Issue URL: https://app.asana.com/0/1202552961248957/1208851110314077/f

Description

Steps to test this PR

Smoke test Duck Player

UI changes

Before After
!(Upload before screenshot) (Upload after screenshot)

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CDRussell
Copy link
Member

CDRussell commented Dec 3, 2024

@CrisBarreiro, would it make things easier to mark isSimulatedYoutubeNoCookie as a suspend function, instead of the changes in this PR?

  • that’s the only thing I can see calling duckPlayerLocalFilesPath.assetsPath()
  • isSimulatedYoutubeNoCookie is only ever called from coroutines anyway so there wouldn't be a large bubble-up effect of adding the suspend marker

if you did that, could ensure that duckPlayerLocalFilesPath.assetsPath() is called on the io dispatcher

@CrisBarreiro
Copy link
Contributor Author

@CrisBarreiro, would it make things easier to mark isSimulatedYoutubeNoCookie as a suspend function, instead of the changes in this PR?

* that’s the only thing I can see calling `duckPlayerLocalFilesPath.assetsPath()`

* `isSimulatedYoutubeNoCookie` is only ever called from coroutines anyway so there wouldn't be a large bubble-up effect of adding the `suspend` marker

if you did that, could ensure that duckPlayerLocalFilesPath.assetsPath() is called on the io dispatcher

@CDRussell there's one usage that doesn't come from a suspend fun. However, since we're prefetching and caching the value of assetsPath, I don't think it's needed. Moreover, we removed all suspend functions in #5257, which fixed the prior ANR, so I would prefer to try this out first, and not go back to suspend functions that ultimately will require a runBlocking

Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

LGTM :shipit:

Copy link
Contributor

@joshliebe joshliebe left a comment

Choose a reason for hiding this comment

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

Tested and works as expected ✅
This should fix the ANR, nicely done 👍

@CrisBarreiro CrisBarreiro merged commit 747c4af into develop Dec 10, 2024
9 checks passed
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.

4 participants