feat: enforce community source cooldown
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s

This commit is contained in:
ik
2026-09-05 07:52:37 +07:00
parent 1a09bd59f3
commit 3f468799bd
10 changed files with 114 additions and 8 deletions
+15
View File
@@ -0,0 +1,15 @@
from pathlib import Path
import pytest
from rf4_research.community_cli import enforce_fetch_interval, mark_fetch
def test_fetch_cooldown_is_persistent_per_source(tmp_path: Path) -> None:
state_file = tmp_path / "fetch-state.json"
mark_fetch("rf4map-point", state_file=state_file, now=1_000)
with pytest.raises(RuntimeError, match="retry in 1800 seconds"):
enforce_fetch_interval("rf4map-point", state_file=state_file, now=1_000)
enforce_fetch_interval("rf4posts-spot", state_file=state_file, now=1_000)
enforce_fetch_interval("rf4map-point", state_file=state_file, now=2_800)