fix(freshness): пороги nspd_geo под on-demand каденцию (убирает еженедельный ложный stale) (#2325)
This commit is contained in:
parent
7fd80adfa7
commit
01f2c5290d
2 changed files with 9 additions and 7 deletions
|
|
@ -1404,8 +1404,12 @@ _FRESHNESS_SOURCES: list[FreshnessSource] = [
|
||||||
table="nspd_geo_jobs",
|
table="nspd_geo_jobs",
|
||||||
work_col="targets_done",
|
work_col="targets_done",
|
||||||
attempt_fallback_col="created_at",
|
attempt_fallback_col="created_at",
|
||||||
fresh_days=7.0,
|
# On-demand источник БЕЗ cron (admin UI / CLI / lazy из analyze) — штучные
|
||||||
stale_days=30.0,
|
# фетчи по активности пользователя. fresh_days=7 флагал каждую неделю
|
||||||
|
# тишины ложным stale-алертом (расследование 2026-07-04); пороги — под
|
||||||
|
# реальную каденцию, critical=False и так не трогает overall.
|
||||||
|
fresh_days=30.0,
|
||||||
|
stale_days=90.0,
|
||||||
),
|
),
|
||||||
FreshnessSource(
|
FreshnessSource(
|
||||||
source="cadastre",
|
source="cadastre",
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ def test_freshness_mixed_statuses() -> None:
|
||||||
"last_status": None,
|
"last_status": None,
|
||||||
},
|
},
|
||||||
"nspd_geo_jobs": {
|
"nspd_geo_jobs": {
|
||||||
"last_success_at": _ago(40.0), # >= stale_days=30 → critical → failed
|
"last_success_at": _ago(100.0), # >= stale_days=90 → critical → failed
|
||||||
"last_attempt_at": _ago(40.0),
|
"last_attempt_at": _ago(100.0),
|
||||||
"upd_24h": 0,
|
"upd_24h": 0,
|
||||||
"upd_7d": 0,
|
"upd_7d": 0,
|
||||||
"last_status": "done",
|
"last_status": "done",
|
||||||
|
|
@ -230,9 +230,7 @@ def test_freshness_all_healthy() -> None:
|
||||||
"last_status": "done",
|
"last_status": "done",
|
||||||
"recent_output": 100000, # выше любого floor → flagged-источники ok
|
"recent_output": 100000, # выше любого floor → flagged-источники ok
|
||||||
}
|
}
|
||||||
rows = {
|
rows = {s.table: dict(fresh_row) for s in admin_scrape._FRESHNESS_SOURCES}
|
||||||
s.table: dict(fresh_row) for s in admin_scrape._FRESHNESS_SOURCES
|
|
||||||
}
|
|
||||||
_override_db(_make_db(rows))
|
_override_db(_make_db(rows))
|
||||||
try:
|
try:
|
||||||
resp = TestClient(app).get(ENDPOINT)
|
resp = TestClient(app).get(ENDPOINT)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue