Stage 07.4.3.2 — price polling, event bus and UI throttling

This commit is contained in:
2026-05-02 14:57:43 +03:00
parent 38c8686a9b
commit bd6b40fcb2
9 changed files with 644 additions and 31 deletions

28
app/src/core/event_bus.py Normal file
View File

@@ -0,0 +1,28 @@
# app/src/core/event_bus.py
from __future__ import annotations
from typing import Any
class EventBus:
_version: int = 0
_last_event_type: str | None = None
_last_payload: dict[str, Any] = {}
# зафиксировать важное событие системы
@classmethod
def emit(cls, event_type: str, payload: dict[str, Any] | None = None) -> None:
cls._version += 1
cls._last_event_type = event_type
cls._last_payload = payload or {}
# текущая версия событий
@classmethod
def version(cls) -> int:
return cls._version
# последнее событие
@classmethod
def last_event(cls) -> tuple[str | None, dict[str, Any]]:
return cls._last_event_type, dict(cls._last_payload)