From f4ef7e1b5622dcd62c600f1bf3957f3adf2f9e17 Mon Sep 17 00:00:00 2001 From: Henrik Friedrichsen Date: Mon, 12 Sep 2022 23:14:20 +0200 Subject: [PATCH] Fix: remove broken staleness detection Ever since albums were sorted the cache staleness detection stopped working as the order of items plays into the check. Remove it as it currently doesn't work. It also wasn't a very good check. --- src/library.rs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/library.rs b/src/library.rs index 3f97746..af83416 100644 --- a/src/library.rs +++ b/src/library.rs @@ -379,30 +379,15 @@ impl Library { .api .current_user_saved_albums(albums.len() as u32); debug!("albums page: {}", i); + i += 1; + if page.is_none() { error!("Failed to fetch albums."); return; } + let page = page.unwrap(); - - if page.offset == 0 { - // If first page matches the first items in store and total is - // identical, assume list is unchanged. - - let store = self.albums.read().unwrap(); - - if page.total as usize == store.len() - && !page - .items - .iter() - .enumerate() - .any(|(i, a)| a.album.id.id() != store[i].id.clone().unwrap_or_default()) - { - return; - } - } - albums.extend(page.items.iter().map(|a| a.into())); if page.next.is_none() {