feat(subscriptions): live posts-processed progress on backfill/recovery — #704 step 2
The running badge only showed the chunk counter; now it shows posts walked — real walk progress. The ingester already reports posts_processed per chunk (step 1); the backfill lifecycle accumulates it into config_overrides._backfill_posts across chunks. SourceRecord exposes backfill_posts; start_backfill/start_recovery clear it (fresh walk); stop clears it too. SourceRow/SourceCard badge renders "Recovering · 45 posts" (falls back to "(N)" chunks before any posts are counted). Per-chunk accumulation (no mid-walk DB write) — simple and race-free; a small over-count from each chunk re-walking its resumed page is fine for a progress indicator. Tests: lifecycle accumulates posts_processed across chunks; start clears a prior _backfill_posts and the record exposes it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -515,6 +515,13 @@ class DownloadService:
|
||||
new_overrides = dict(src.config_overrides or {})
|
||||
chunks = int(new_overrides.get("_backfill_chunks", 0)) + 1
|
||||
new_overrides["_backfill_chunks"] = chunks
|
||||
# plan #704 (#5): accumulate posts-processed across chunks so the badge
|
||||
# shows live walk progress, not just the chunk count. Cleared on
|
||||
# (re)start. (Slight over-count: each chunk re-walks the resumed page —
|
||||
# fine for a progress indicator.)
|
||||
new_overrides["_backfill_posts"] = int(
|
||||
new_overrides.get("_backfill_posts", 0)
|
||||
) + int(getattr(dl_result, "posts_processed", 0) or 0)
|
||||
|
||||
completed = (
|
||||
dl_result.success
|
||||
|
||||
Reference in New Issue
Block a user