fix(scheduler): prevent auto-enable with wrong interval on page load
Root cause: GET /api/sync/schedule returned interval_minutes=null when scheduler was stopped, causing dropdown to stay on first HTML option (1 min). Setting .value programmatically could trigger onchange, sending a second PUT with interval=1 right after the user's intended interval. - GET schedule falls back to DB/default (10 min) when scheduler is off - Add _schedulerLoading flag to block onchange during loadSchedulerStatus - Default interval 10 min everywhere (was 5 in backend) - Cache bust dashboard.js v=33 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -804,8 +804,12 @@ async def update_schedule(config: ScheduleConfig):
|
||||
|
||||
@router.get("/api/sync/schedule")
|
||||
async def get_schedule():
|
||||
"""Get current scheduler status."""
|
||||
return scheduler_service.get_scheduler_status()
|
||||
"""Get current scheduler status (falls back to DB for interval)."""
|
||||
status = scheduler_service.get_scheduler_status()
|
||||
if status["interval_minutes"] is None:
|
||||
config = await sqlite_service.get_scheduler_config()
|
||||
status["interval_minutes"] = int(config.get("interval_minutes", "10"))
|
||||
return status
|
||||
|
||||
|
||||
@router.get("/api/settings")
|
||||
|
||||
Reference in New Issue
Block a user