feat(worker): ручной пересчёт метрик через очередь, диагностика шагов и heartbeat
POST /metrics/refresh ставит задачу в sync_job (source=METRICS_JOB) и отвечает 202, пересчёт делает worker; GET /metrics/status отдаёт refreshing и consistent. metric_refresh_log хранит failed_step и step_timings. Источники с needs="tinvest_token" не попадают в расписание без токена, tinvest/moex добавлены в default_schedule. Воркер трогает heartbeat-файл для healthcheck.
This commit is contained in:
@@ -135,6 +135,11 @@ class MetricRefreshLog(Base):
|
||||
trigger: Mapped[str] = mapped_column(String(32))
|
||||
"""sync:<source> | manual | cli"""
|
||||
error: Mapped[str | None] = mapped_column(Text)
|
||||
failed_step: Mapped[str | None] = mapped_column(String(64))
|
||||
"""Name of the step that raised. Steps before it committed and the ones after it did not
|
||||
run, so the metric tables then come from two different runs."""
|
||||
step_timings: Mapped[dict[str, Any] | None]
|
||||
"""Seconds per step that completed, in run order."""
|
||||
|
||||
|
||||
class MetricPortfolioValueDaily(Base):
|
||||
|
||||
Reference in New Issue
Block a user