fix(freshness): пороги nspd_geo под on-demand каденцию (убирает еженедельный ложный stale) (#2325)
All checks were successful
Deploy / changes (push) Successful in 8s
Deploy / build-frontend (push) Has been skipped
Deploy / build-backend (push) Successful in 1m50s
Deploy / build-worker (push) Successful in 3m3s
Deploy / deploy (push) Successful in 1m43s

This commit is contained in:
bot-backend 2026-07-03 21:46:30 +00:00
parent 7fd80adfa7
commit 01f2c5290d
2 changed files with 9 additions and 7 deletions

View file

@ -1404,8 +1404,12 @@ _FRESHNESS_SOURCES: list[FreshnessSource] = [
table="nspd_geo_jobs",
work_col="targets_done",
attempt_fallback_col="created_at",
fresh_days=7.0,
stale_days=30.0,
# On-demand источник БЕЗ cron (admin UI / CLI / lazy из analyze) — штучные
# фетчи по активности пользователя. fresh_days=7 флагал каждую неделю
# тишины ложным stale-алертом (расследование 2026-07-04); пороги — под
# реальную каденцию, critical=False и так не трогает overall.
fresh_days=30.0,
stale_days=90.0,
),
FreshnessSource(
source="cadastre",

View file

@ -89,8 +89,8 @@ def test_freshness_mixed_statuses() -> None:
"last_status": None,
},
"nspd_geo_jobs": {
"last_success_at": _ago(40.0), # >= stale_days=30 → critical → failed
"last_attempt_at": _ago(40.0),
"last_success_at": _ago(100.0), # >= stale_days=90 → critical → failed
"last_attempt_at": _ago(100.0),
"upd_24h": 0,
"upd_7d": 0,
"last_status": "done",
@ -230,9 +230,7 @@ def test_freshness_all_healthy() -> None:
"last_status": "done",
"recent_output": 100000, # выше любого floor → flagged-источники ok
}
rows = {
s.table: dict(fresh_row) for s in admin_scrape._FRESHNESS_SOURCES
}
rows = {s.table: dict(fresh_row) for s in admin_scrape._FRESHNESS_SOURCES}
_override_db(_make_db(rows))
try:
resp = TestClient(app).get(ENDPOINT)