@@ -209,29 +209,18 @@ pub(crate) async fn list_content(
209209 . await ?;
210210 let imported_modpack_scope = is_imported_modpack_scope ( & link) ;
211211 let linked_modpack_source_kind = linked_modpack_source_kind ( & link) ;
212- let mut failed_modpack_identifier_lookup = false ;
213212 let modpack_ids = if imported_modpack_scope {
214213 None
215214 } else {
216215 match linked_modpack_ids ( & link) {
217- Some ( ( _, version_id) ) => match get_modpack_identifiers (
218- & version_id,
219- & resolved. content_set ,
220- & state. pool ,
221- & state. api_semaphore ,
222- )
223- . await
224- {
225- Ok ( ids) => Some ( ids) ,
226- Err ( err) => {
227- tracing:: warn!(
228- "Failed to fetch modpack identifiers: {}" ,
229- err
230- ) ;
231- failed_modpack_identifier_lookup = true ;
232- None
233- }
234- } ,
216+ Some ( ( _, version_id) ) => {
217+ get_cached_modpack_identifiers (
218+ & version_id,
219+ & state. pool ,
220+ & state. api_semaphore ,
221+ )
222+ . await ?
223+ }
235224 None => None ,
236225 }
237226 } ;
@@ -243,10 +232,9 @@ pub(crate) async fn list_content(
243232 }
244233 } else if let Some ( ids) = modpack_ids. as_ref ( ) {
245234 ContentFilter :: ExcludeModpack ( ids)
246- } else if failed_modpack_identifier_lookup {
235+ } else if let Some ( source_kind ) = linked_modpack_source_kind {
247236 ContentFilter :: ExcludeSourceKind {
248- source_kind : linked_modpack_source_kind
249- . unwrap_or ( ContentSourceKind :: ModrinthModpack ) ,
237+ source_kind,
250238 exclude_untracked : true ,
251239 }
252240 } else {
@@ -1182,6 +1170,28 @@ impl ModpackIdentifiers {
11821170 }
11831171}
11841172
1173+ async fn get_cached_modpack_identifiers (
1174+ version_id : & str ,
1175+ pool : & SqlitePool ,
1176+ fetch_semaphore : & FetchSemaphore ,
1177+ ) -> crate :: Result < Option < ModpackIdentifiers > > {
1178+ let Some ( cached) =
1179+ CachedEntry :: get_modpack_files ( version_id, pool, fetch_semaphore)
1180+ . await ?
1181+ else {
1182+ return Ok ( None ) ;
1183+ } ;
1184+
1185+ if cached. project_ids . is_empty ( ) {
1186+ return Ok ( None ) ;
1187+ }
1188+
1189+ Ok ( Some ( ModpackIdentifiers {
1190+ hashes : cached. file_hashes . into_iter ( ) . collect ( ) ,
1191+ project_ids : cached. project_ids . into_iter ( ) . collect ( ) ,
1192+ } ) )
1193+ }
1194+
11851195async fn get_modpack_identifiers (
11861196 version_id : & str ,
11871197 content_set : & ContentSet ,
0 commit comments