(request: AutoQuickRefreshSettingsRequest)
| 184 | |
| 185 | @router.post("/auto-quick-refresh") |
| 186 | async def update_auto_quick_refresh_settings(request: AutoQuickRefreshSettingsRequest): |
| 187 | from ..auto_quick_refresh_scheduler import ( |
| 188 | AUTO_MAX_RETRY_LIMIT, |
| 189 | AUTO_MAX_INTERVAL_MINUTES, |
| 190 | AUTO_MIN_INTERVAL_MINUTES, |
| 191 | auto_quick_refresh_scheduler, |
| 192 | ) |
| 193 | |
| 194 | interval_minutes = int(request.interval_minutes) |
| 195 | retry_limit = int(request.retry_limit) |
| 196 | |
| 197 | if interval_minutes < AUTO_MIN_INTERVAL_MINUTES or interval_minutes > AUTO_MAX_INTERVAL_MINUTES: |
| 198 | raise HTTPException( |
| 199 | status_code=400, |
| 200 | detail=f"interval_minutes must be between {AUTO_MIN_INTERVAL_MINUTES} and {AUTO_MAX_INTERVAL_MINUTES}", |
| 201 | ) |
| 202 | if retry_limit < 0 or retry_limit > AUTO_MAX_RETRY_LIMIT: |
| 203 | raise HTTPException( |
| 204 | status_code=400, |
| 205 | detail=f"retry_limit must be between 0 and {AUTO_MAX_RETRY_LIMIT}", |
| 206 | ) |
| 207 | |
| 208 | update_settings( |
| 209 | auto_quick_refresh_enabled=bool(request.enabled), |
| 210 | auto_quick_refresh_interval_minutes=interval_minutes, |
| 211 | auto_quick_refresh_retry_limit=retry_limit, |
| 212 | ) |
| 213 | |
| 214 | runtime = auto_quick_refresh_scheduler.notify_schedule_updated() |
| 215 | if request.enabled and bool(request.run_now): |
| 216 | runtime = auto_quick_refresh_scheduler.request_run_now(reason="settings_save") |
| 217 | |
| 218 | return { |
| 219 | "success": True, |
| 220 | "enabled": bool(request.enabled), |
| 221 | "interval_minutes": interval_minutes, |
| 222 | "retry_limit": retry_limit, |
| 223 | "runtime": runtime, |
| 224 | } |
| 225 | |
| 226 | |
| 227 | @router.get("/proxy/dynamic") |
nothing calls this directly
no test coverage detected