Fixed bug where get_cached_statuses didn't return a value for all songs in some cases

This commit is contained in:
Sumner Evans
2020-05-27 00:14:24 -06:00
parent 420ad79c24
commit bdce6b45a2

View File

@@ -217,19 +217,22 @@ class FilesystemAdapter(CachingAdapter):
return SongCacheStatus.NOT_CACHED return SongCacheStatus.NOT_CACHED
cached_statuses = {song_id: SongCacheStatus.NOT_CACHED for song_id in song_ids}
try: try:
file_models = models.CacheInfo.select().where( file_models = models.CacheInfo.select().where(
models.CacheInfo.cache_key == KEYS.SONG_FILE models.CacheInfo.cache_key == KEYS.SONG_FILE
) )
song_models = models.Song.select().where(models.Song.id.in_(song_ids)) song_models = models.Song.select().where(models.Song.id.in_(song_ids))
return { cached_statuses.update(
s.id: compute_song_cache_status(s) {
for s in prefetch(song_models, file_models) s.id: compute_song_cache_status(s)
} for s in prefetch(song_models, file_models)
}
)
except Exception: except Exception:
pass pass
return {song_id: SongCacheStatus.NOT_CACHED for song_id in song_ids} return cached_statuses
_playlists = None _playlists = None