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

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

View File

@@ -18,7 +18,7 @@
2} | Loops: Active"
>
<!-- Content omitted for brevity, preserved in file -->
{#if $ae_loc.native_device}
{#if $events_loc.launcher.sync_intervals}
<div class="grid grid-cols-1 gap-3">
<!-- Technical Timers (Edit Mode Only) -->
{#if $ae_loc.edit_mode}
@@ -34,8 +34,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_loop_period
$events_loc.launcher.sync_intervals.event
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -47,8 +46,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_device_loop_period
$events_loc.launcher.sync_intervals.device
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -60,8 +58,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_location_loop_period
$events_loc.launcher.sync_intervals.location
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -73,8 +70,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_session_loop_period
$events_loc.launcher.sync_intervals.session
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -86,8 +82,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_presentation_loop_period
$events_loc.launcher.sync_intervals.presentation
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -99,8 +94,7 @@
<input
type="number"
bind:value={
$ae_loc.native_device
.check_event_presenter_loop_period
$events_loc.launcher.sync_intervals.presenter
}
class="input input-sm text-[10px] h-7 preset-tonal-surface"
/>
@@ -144,7 +138,7 @@
<span>Event Sync:</span>
<span
>{(
$ae_loc.native_device.check_event_loop_period /
$events_loc.launcher.sync_intervals.event /
1000
).toFixed(1)}s</span
>
@@ -155,8 +149,7 @@
<span>Room Monitor:</span>
<span
>{(
$ae_loc.native_device
.check_event_location_loop_period / 1000
$events_loc.launcher.sync_intervals.location / 1000
).toFixed(1)}s</span
>
</div>
@@ -165,7 +158,7 @@
>
<span>Prefix Sharding:</span>
<span
>{$ae_loc.native_device.hash_prefix_length || 2} chars</span
>{$ae_loc.native_device?.hash_prefix_length || 2} chars</span
>
</div>
</div>

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