From c8c66a3514259647cbae1bcdd3af42206f02c901 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 4 Mar 2026 18:19:51 -0500 Subject: [PATCH] fix(launcher): add sync pause toggle and reduce default polling intervals The SWR pattern always fires a background API call on cache hits, so the 15s session interval created a continuous API stream even when data was fresh. Increased all defaults: session 15s->60s, location/device 30s->60s, presentation/presenter 45-60s->120s. Added sync_paused guard to all six refresh functions and a Pause/Resume toggle in the Sync Timers config section (visible without edit mode) so testing and troubleshooting don't require a full reload. Co-Authored-By: Claude Sonnet 4.6 --- .../launcher_cfg_sync_timers.svelte | 20 +++++++++++++++++++ .../launcher_background_sync.svelte | 17 ++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_sync_timers.svelte b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_sync_timers.svelte index c28eb7f3..581936ea 100644 --- a/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_sync_timers.svelte +++ b/src/routes/events/[event_id]/(launcher)/cfg_components/launcher_cfg_sync_timers.svelte @@ -18,6 +18,26 @@ 2} | Loops: Active" > + +
+ + {$events_loc.launcher.sync_paused ? '⏸ Sync Paused' : '▶ Sync Active'} + + +
+ {#if $events_loc.launcher.sync_intervals}
diff --git a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte index 29252730..ff6a86a3 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -21,13 +21,16 @@ let last_heartbeat: string | null = $state(null); // Loop Timings (Visible in UI) + // WHY: Session was 15s which combined with the SWR background-refresh pattern + // caused a continuous API call every 15s even on cache hits. 60s is still + // responsive for live conference use but dramatically reduces server load. let loop_info = $state({ event: 90000, device: 60000, - location: 30000, - session: 15000, - presentation: 45000, - presenter: 60000 + location: 60000, + session: 60000, + presentation: 120000, + presenter: 120000 }); // Timer Handles @@ -116,6 +119,7 @@ * API Refresh: Event */ async function refresh_event_data() { + if ($events_loc.launcher.sync_paused) return; if (!$events_slct.event_id) return; try { await events_func.load_ae_obj_id__event({ @@ -134,6 +138,7 @@ * API Refresh: Sessions in Room */ async function refresh_session_data() { + if ($events_loc.launcher.sync_paused) return; const location_id = $events_slct.event_location_id; if (!location_id) return; try { @@ -153,6 +158,7 @@ * API Refresh: Presentations for Selected Session */ async function refresh_presentation_data() { + if ($events_loc.launcher.sync_paused) return; const session_id = $events_slct.event_session_id; if (!session_id) return; try { @@ -171,6 +177,7 @@ * API Refresh: Presenters for Selected Session */ async function refresh_presenter_data() { + if ($events_loc.launcher.sync_paused) return; const session_id = $events_slct.event_session_id; if (!session_id) return; try { @@ -186,6 +193,7 @@ } async function run_sync_cycle() { + if ($events_loc.launcher.sync_paused) return; const location_id = $events_slct.event_location_id; const cache_root = $ae_loc.local_file_cache_path; const prefix_len = $ae_loc.native_device?.hash_prefix_length || 2; @@ -373,6 +381,7 @@ * Ensures we have latest room settings. */ async function refresh_location_config() { + if ($events_loc.launcher.sync_paused) return; const location_id = $events_slct.event_location_id; if (!location_id) return;