feat: expose safe source health status
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-07 16:57:14 +07:00
parent 0701383c28
commit 486016d977
12 changed files with 90 additions and 11 deletions
+8 -1
View File
@@ -1,7 +1,7 @@
import pytest
from pydantic import ValidationError
from app.community_scheduler import configured_sources
from app.community_scheduler import MAX_BACKOFF_SECONDS, configured_sources, retry_delay
from app.config import Settings
@@ -12,3 +12,10 @@ def test_all_authorized_sources_are_scheduled() -> None:
def test_community_interval_cannot_be_less_than_30_minutes() -> None:
with pytest.raises(ValidationError):
Settings(community_import_interval_seconds=1799)
def test_failed_runs_back_off_but_success_resets_delay() -> None:
assert retry_delay(["failed"]) == 1800
assert retry_delay(["failed", "failed", "failed"]) == 7200
assert retry_delay(["failed"] * 20) == MAX_BACKOFF_SECONDS
assert retry_delay(["success", "failed"]) == 1800