Patreon: enforce the backfill time-box mid-post (stop soft-limit overruns) #78
@@ -349,11 +349,14 @@ async def test_tick_does_not_checkpoint_cursor(source_id, sync_engine, tmp_path,
|
||||
async def test_backfill_budget_cut_returns_partial_with_progress(
|
||||
source_id, sync_engine, tmp_path, monkeypatch,
|
||||
):
|
||||
# Deterministic clock: start=0, post1 check=10 (ok), post2 check=200 (>budget).
|
||||
# run() lives in ingest_core now, so patch the clock there (the same global
|
||||
# time module object, but we reference it through the module that uses it).
|
||||
# Deterministic clock: start=0; post1 gate=10 (ok); post1's per-media
|
||||
# should_stop=20 (still ok, so post1's item downloads); post1 live-progress
|
||||
# read=200; post2 gate=250 (>budget → cut). The per-media should_stop check
|
||||
# (added 2026-06-07 to bound media-dense posts) reads the clock once more per
|
||||
# post, so the sequence carries the extra tick. run() lives in ingest_core
|
||||
# now, so patch the clock there.
|
||||
import backend.app.services.ingest_core as core
|
||||
ticks = iter([0.0, 10.0, 200.0, 250.0])
|
||||
ticks = iter([0.0, 10.0, 20.0, 200.0, 250.0])
|
||||
last = [0.0]
|
||||
|
||||
def fake_monotonic():
|
||||
|
||||
Reference in New Issue
Block a user