feat: event eco
This commit is contained in:
@@ -15,6 +15,7 @@ class ApiKeysRequest(BaseModel):
|
||||
fmp_api_key: Optional[str] = None
|
||||
te_api_key: Optional[str] = None
|
||||
calendar_refresh_h: Optional[str] = None
|
||||
calendar_scrape_refresh_h: Optional[str] = None
|
||||
|
||||
|
||||
class SourcesRequest(BaseModel):
|
||||
@@ -73,6 +74,9 @@ def update_api_keys(req: ApiKeysRequest):
|
||||
if req.calendar_refresh_h is not None:
|
||||
set_config("calendar_refresh_h", req.calendar_refresh_h)
|
||||
updated.append("calendar_refresh_h")
|
||||
if req.calendar_scrape_refresh_h is not None:
|
||||
set_config("calendar_scrape_refresh_h", req.calendar_scrape_refresh_h)
|
||||
updated.append("calendar_scrape_refresh_h")
|
||||
return {"status": "ok", "updated": updated}
|
||||
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ def ff_page_import_status() -> Dict[str, Any]:
|
||||
def _run_calendar_sync(weeks_ahead: int):
|
||||
from services.calendar_sync import calendar_sync
|
||||
try:
|
||||
calendar_sync(weeks_ahead=weeks_ahead)
|
||||
calendar_sync(weeks_ahead=weeks_ahead, force_scrape=True)
|
||||
except Exception as e:
|
||||
logger.error(f"[eco/calendar-sync] Failed: {e}")
|
||||
|
||||
@@ -553,7 +553,9 @@ def calendar_sync_ep(
|
||||
background_tasks: BackgroundTasks,
|
||||
weeks: int = Query(8, ge=1, le=12),
|
||||
) -> Dict[str, Any]:
|
||||
"""Trigger unified calendar sync (FF live JSON thisweek+nextweek + FF HTML scraper) in background."""
|
||||
"""Trigger unified calendar sync (FF live JSON thisweek+nextweek + FF HTML scraper) in
|
||||
background. Manual trigger always runs the scraper regardless of its own throttle —
|
||||
only the automatic background loop respects calendar_scrape_refresh_h."""
|
||||
from services.calendar_sync import get_sync_status
|
||||
if get_sync_status()["running"]:
|
||||
raise HTTPException(409, "Calendar sync already running")
|
||||
|
||||
Reference in New Issue
Block a user