feat: cycle
This commit is contained in:
@@ -495,14 +495,15 @@ def _to_event_dict(ev: Dict[str, Any]) -> Dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
async def bootstrap_ma_events() -> Dict[str, Any]:
|
||||
async def bootstrap_ma_events(force: bool = False) -> Dict[str, Any]:
|
||||
"""
|
||||
Main entrypoint. Detects MA ruptures, enriches with GPT, saves to DB.
|
||||
Idempotent: skips if DB already has > 100 events.
|
||||
Idempotent by default: skips if DB already has > 100 events. Pass force=True
|
||||
to bypass this guard (same convention as bootstrap_macro_events/bootstrap_eco_events).
|
||||
Returns {"detected": N, "saved": N, "skipped": N}.
|
||||
"""
|
||||
existing = count_market_events()
|
||||
if existing > 100:
|
||||
if existing > 100 and not force:
|
||||
logger.info(f"[MA] DB already has {existing} events — skipping bootstrap")
|
||||
return {"detected": 0, "saved": 0, "skipped": existing}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user