diff --git a/backend/src/crawler/resync.rs b/backend/src/crawler/resync.rs index 25ce459..5f25759 100644 --- a/backend/src/crawler/resync.rs +++ b/backend/src/crawler/resync.rs @@ -135,28 +135,7 @@ impl ResyncService for RealResyncService { .await .with_context(|| format!("fetch_manga during resync of {manga_id}"))?; - // Partial-render guard: same logic as run_metadata_pass. let source_id = source.id(); - if !manga.chapters.is_empty() || { - let prior = repo::crawler::live_chapter_count_for_source_manga( - &self.db, - source_id, - &source_manga_key, - ) - .await - .unwrap_or(0); - prior == 0 - } { - // Either the new fetch surfaced chapters, or there were - // none before either — chapter sync is safe to run. - } else { - tracing::warn!( - %manga_id, - source_url = %source_url, - "resync_manga: fetch returned empty chapters but prior count > 0; skipping chapter sync to avoid soft-drop" - ); - } - let upsert = repo::crawler::upsert_manga_from_source( &self.db, source_id, @@ -201,6 +180,11 @@ impl ResyncService for RealResyncService { ) .await .unwrap_or(0); + // Partial-render guard (same logic as run_metadata_pass): only sync + // chapters when the fetch surfaced some, or the manga never had any. + // A fetch that returned empty while a prior count exists is almost + // certainly a partial render — skip the sync so we don't soft-drop the + // real chapters. if !manga.chapters.is_empty() || prior_chapter_count == 0 { match repo::crawler::sync_manga_chapters( &self.db, @@ -223,6 +207,12 @@ impl ResyncService for RealResyncService { "resync_manga: chapter sync failed" ), } + } else { + tracing::warn!( + %manga_id, + source_url = %source_url, + "resync_manga: fetch returned empty chapters but prior count > 0; skipping chapter sync to avoid soft-drop" + ); } drop(lease);