Do not search for more than 99 images at a time

This commit is contained in:
Philip Kristoffersen
2022-04-18 21:08:08 +02:00
parent e9d10499f2
commit 06de2bdf60
+4 -2
View File
@@ -43,7 +43,7 @@ pub async fn download_images_for_users<'b>(
let shortcut_info = get_shortcuts_for_user(user); let shortcut_info = get_shortcuts_for_user(user);
async move { async move {
let known_images = get_users_images(user).unwrap_or_default(); let known_images = get_users_images(user).unwrap_or_default();
let res = search_fo_to_download( let res = search_for_images_to_download(
known_images, known_images,
user.steam_user_data_folder.as_str(), user.steam_user_data_folder.as_str(),
&shortcut_info.shortcuts, &shortcut_info.shortcuts,
@@ -113,7 +113,7 @@ pub struct PublicGameResponse {
data: Option<PublicGameResponseData>, data: Option<PublicGameResponseData>,
} }
async fn search_fo_to_download( async fn search_for_images_to_download(
known_images: Vec<String>, known_images: Vec<String>,
user_data_folder: &str, user_data_folder: &str,
shortcuts: &[ShortcutOwned], shortcuts: &[ShortcutOwned],
@@ -196,6 +196,7 @@ async fn search_fo_to_download(
} }
} }
} else { } else {
for image_ids in image_ids.chunks(99){
let image_search_result = let image_search_result =
get_images_for_ids(client, &image_ids, &image_type, download_animated).await; get_images_for_ids(client, &image_ids, &image_type, download_animated).await;
match image_search_result { match image_search_result {
@@ -229,6 +230,7 @@ async fn search_fo_to_download(
} }
} }
} }
}
Ok(to_download) Ok(to_download)
} }