refactor: remove dead partial-render guard in resync_manga
The first guard block computed the partial-render condition but had an empty if-body, so it never skipped anything — the real skip is the chapter-sync guard further down. Delete the dead block and move its observability warning into the live guard's else branch, eliminating the data-loss trap without changing behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -135,28 +135,7 @@ impl ResyncService for RealResyncService {
|
|||||||
.await
|
.await
|
||||||
.with_context(|| format!("fetch_manga during resync of {manga_id}"))?;
|
.with_context(|| format!("fetch_manga during resync of {manga_id}"))?;
|
||||||
|
|
||||||
// Partial-render guard: same logic as run_metadata_pass.
|
|
||||||
let source_id = source.id();
|
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(
|
let upsert = repo::crawler::upsert_manga_from_source(
|
||||||
&self.db,
|
&self.db,
|
||||||
source_id,
|
source_id,
|
||||||
@@ -201,6 +180,11 @@ impl ResyncService for RealResyncService {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap_or(0);
|
.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 {
|
if !manga.chapters.is_empty() || prior_chapter_count == 0 {
|
||||||
match repo::crawler::sync_manga_chapters(
|
match repo::crawler::sync_manga_chapters(
|
||||||
&self.db,
|
&self.db,
|
||||||
@@ -223,6 +207,12 @@ impl ResyncService for RealResyncService {
|
|||||||
"resync_manga: chapter sync failed"
|
"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);
|
drop(lease);
|
||||||
|
|||||||
Reference in New Issue
Block a user