From 475954b7911168a89ad12354e80a0146f51a2e92 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 10 Feb 2026 18:28:13 -0500 Subject: [PATCH] feat(sync): persist polling intervals across all Launcher variants - Migrated background timers to persistent 'sync_intervals' store.\n- Updated Sync Monitor and Config UI to display and edit all six polling loops.\n- Ensured timer settings are applied and persisted regardless of native mode status.\n- Refined initialization logic to prioritize user configuration with robust fallbacks. --- src/lib/stores/ae_events_stores.ts | 10 +++++++ .../launcher_cfg_sync_timers.svelte | 27 +++++++------------ .../launcher_background_sync.svelte | 19 ++++++------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/lib/stores/ae_events_stores.ts b/src/lib/stores/ae_events_stores.ts index ef0f591a..a1b61ae2 100644 --- a/src/lib/stores/ae_events_stores.ts +++ b/src/lib/stores/ae_events_stores.ts @@ -167,6 +167,16 @@ const events_local_data_struct: key_val = { time_format: 'time_12_short', time_hours: 12, // 12 or 24 + sync_intervals: { + event: 90000, + device: 60000, + location: 30000, + session: 15000, + presentation: 45000, + presenter: 60000, + file_sync: 10000 + }, + slct: { event_id: null, event_location_id: null, 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 ca70722f..c28eb7f3 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,7 +18,7 @@ 2} | Loops: Active" > - {#if $ae_loc.native_device} + {#if $events_loc.launcher.sync_intervals}
{#if $ae_loc.edit_mode} @@ -34,8 +34,7 @@ @@ -47,8 +46,7 @@ @@ -60,8 +58,7 @@ @@ -73,8 +70,7 @@ @@ -86,8 +82,7 @@ @@ -99,8 +94,7 @@ @@ -144,7 +138,7 @@ Event Sync: {( - $ae_loc.native_device.check_event_loop_period / + $events_loc.launcher.sync_intervals.event / 1000 ).toFixed(1)}s @@ -155,8 +149,7 @@ Room Monitor: {( - $ae_loc.native_device - .check_event_location_loop_period / 1000 + $events_loc.launcher.sync_intervals.location / 1000 ).toFixed(1)}s
@@ -165,7 +158,7 @@ > Prefix Sharding: {$ae_loc.native_device.hash_prefix_length || 2} chars{$ae_loc.native_device?.hash_prefix_length || 2} chars 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 5ec6a72b..c48af058 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -5,7 +5,7 @@ */ import { onMount, onDestroy } from 'svelte'; import { ae_loc, ae_api } from '$lib/stores/ae_stores'; - import { events_slct, events_sess } from '$lib/stores/ae_events_stores'; + import { events_loc, events_slct, events_sess } from '$lib/stores/ae_events_stores'; import { events_func } from '$lib/ae_events_functions'; import { ae_util } from '$lib/ae_utils/ae_utils'; import { db_events } from '$lib/ae_events/db_events'; @@ -67,14 +67,15 @@ } const dev = $ae_loc.native_device || {}; + const cfg = $events_loc.launcher.sync_intervals || {}; - // Load timings from device config - loop_info.event = dev.check_event_loop_period || 120000; - loop_info.device = dev.check_event_device_loop_period || 90000; - loop_info.location = dev.check_event_location_loop_period || 60000; - loop_info.session = dev.check_event_session_loop_period || 45000; - loop_info.presentation = dev.check_event_presentation_loop_period || 90000; - loop_info.presenter = dev.check_event_presenter_loop_period || 45000; + // Load timings from persistent config, with fallbacks to device config or defaults + loop_info.event = cfg.event || dev.check_event_loop_period || 90000; + loop_info.device = cfg.device || dev.check_event_device_loop_period || 60000; + loop_info.location = cfg.location || dev.check_event_location_loop_period || 30000; + loop_info.session = cfg.session || dev.check_event_session_loop_period || 15000; + loop_info.presentation = cfg.presentation || dev.check_event_presentation_loop_period || 45000; + loop_info.presenter = cfg.presenter || dev.check_event_presenter_loop_period || 60000; // 1. Structural/Metadata Loops timer__event = setInterval(() => refresh_event_data(), loop_info.event); @@ -87,7 +88,7 @@ timer__presenter = setInterval(() => refresh_presenter_data(), loop_info.presenter); // 3. Native File Sync Loop (Dexie -> Disk) - const sync_period = dev.check_file_sync_loop_period || 10000; + const sync_period = cfg.file_sync || dev.check_file_sync_loop_period || 10000; timer__file_sync = setInterval(() => run_sync_cycle(), sync_period); // Immediate first run for metadata