-
Notifications
You must be signed in to change notification settings - Fork 22
Description
🌎 Environment
Shuttle2, built from source
💬 Description
When I import a large library (7000+ songs) into a S2 Media Provider, songs are correctly imported, but no playlist is.
🦶 Reproduction Steps
After some investigation, it turns out importSongs() successfully completes, but songRepository.getSongs() in importPlaylists() returns 0 songs.
You probably already hit this issue, because you've hard-coded a delay here.
If I understand correctly, this gives time for the SQL DB to get populated (I suppose that's because songRepository.insertUpdateAndDelete(...) is some kind of async coroutine/background task/something around those lines?) As one could expect, this is not a definitive solution, because any arbitrary delay here would be defeated by any large enough library.
I am not experienced enough, but do you think of any clean solution?
Could we make the SQL insertion synchronous? Otherwise, could we check (every 100ms for instance) if anything has been added to the DB, and proceed with importPlaylists() only when this is done?
Thanks for your insight :)