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

App freezes for a longer time after a download #550

Closed
1 task done
lukeIam opened this issue Feb 4, 2023 · 6 comments
Closed
1 task done

App freezes for a longer time after a download #550

lukeIam opened this issue Feb 4, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@lukeIam
Copy link

lukeIam commented Feb 4, 2023

Steps to reproduce

  1. Download an audio book with many mp3 files (e.g. ~500MB 232 Tacks or ~500MB 275 Tacks)
  2. Wait till the download reaches 100%
  3. App freezes for 5-9 min (I did multiple tries with different books)
    (A currently playing book continues to play, but the UI is completely frozen + android shows the "wait or kill" message after some time
  4. Wait the 5-9 min and see the successfully imported notification
  5. offline book works fine after waiting

Expected behaviour

  • The ui should not freeze at all (background process?)
  • The import should be faster for 500MB (but the secondary)

Actual behaviour

  • App UI freezes for 5-9 min
  • Android shows the "wait or kill" message
  • If you change out of the app and come back the screen is not updated

Environment data

Audiobookshelf Version: v2.2.14 (also with the version before)
Audiobookshelf App: 0.9.61-beta

  • Android App?

Android Issue

Android version: 12

Device model: Poco X3 NFC
(8 GB RAM, Octa core Snapdragon 732G)

Stock or customized system:
stock (MUUI 13.0.4 stable global)

@lukeIam lukeIam added the bug Something isn't working label Feb 4, 2023
@lukeIam
Copy link
Author

lukeIam commented Feb 4, 2023

addition: if the app is killed while it is freezed the book is half registered - its not showing up as offline and not showing up in the "Local Library Items" menu. But if I click (force) re-scan the notification shows a number including the book in question.
But also after the rescan it not showing up anywhere.

@lukeIam lukeIam changed the title Add freezes for a longer time after a download App freezes for a longer time after a download Feb 4, 2023
@kebbe
Copy link

kebbe commented Feb 4, 2023

Same behavior here, started with 0.9.61 beta
Pixel 6

@advplyr
Copy link
Owner

advplyr commented Feb 4, 2023

Thanks, I'll look into this.

Just to give some more context on how downloading works for anyone interested..

The downloaded files are being downloaded to storage allocated for the app. That is a folder only the app has access to.

After a file is downloaded successfully it is moved to the folder you selected.

The app is using DownloadManager, the built-in Android download API, and it is not allowing downloads directly to "public" folders. That is why I built it to first download to app storage then move to public storage.

After all files are successfully downloaded & moved they are put in a LocalLibraryItem object and stored in the db. The LocalLibraryItem is essentially the same as a LibraryItem from the server except it has additional fields like the server connection it belongs to, the local device paths, etc.

From the description of the issue I believe it is the final step of building the LocalLibraryItem that is taking so long.

@advplyr
Copy link
Owner

advplyr commented Feb 4, 2023

I was able to reproduce this. Not quite as long as you are saying, but it was taking 1 - 2 minutes to process the files after download.

I'm not sure why that part takes that long but I was able to move that off the main thread so it doesn't freeze the UI. I also updated the text on the audiobook page to say "Download complete. Processing..." instead of it looking like it is stuck at 100%.

@advplyr
Copy link
Owner

advplyr commented Feb 23, 2023

Fixed in v0.9.62-beta

@kebbe
Copy link

kebbe commented Feb 24, 2023

Works fine, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants