rebuild(runtime): govern market operations and job truth

This commit is contained in:
leefer
2026-07-30 10:14:29 +08:00
parent 4fc8691eee
commit d8f0dd930c
39 changed files with 2224 additions and 79 deletions
+25
View File
@@ -0,0 +1,25 @@
from __future__ import annotations
import asyncio
import logging
from backend.features.operations.service import OperationsService
logger = logging.getLogger(__name__)
async def run_operations_scheduler(
service: OperationsService, stop: asyncio.Event
) -> None:
while not stop.is_set():
try:
await asyncio.to_thread(service.tick)
except Exception:
logger.exception(
"Operations scheduler tick failed",
extra={"event": "operations.scheduler.failed"},
)
try:
await asyncio.wait_for(stop.wait(), timeout=5)
except TimeoutError:
pass