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.
This commit is contained in:
Scott Idem
2026-02-10 18:28:13 -05:00
parent b91adfd8cf
commit 475954b791
3 changed files with 30 additions and 26 deletions

View File

@@ -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