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:
@@ -167,6 +167,16 @@ const events_local_data_struct: key_val = {
|
|||||||
time_format: 'time_12_short',
|
time_format: 'time_12_short',
|
||||||
time_hours: 12, // 12 or 24
|
time_hours: 12, // 12 or 24
|
||||||
|
|
||||||
|
sync_intervals: {
|
||||||
|
event: 90000,
|
||||||
|
device: 60000,
|
||||||
|
location: 30000,
|
||||||
|
session: 15000,
|
||||||
|
presentation: 45000,
|
||||||
|
presenter: 60000,
|
||||||
|
file_sync: 10000
|
||||||
|
},
|
||||||
|
|
||||||
slct: {
|
slct: {
|
||||||
event_id: null,
|
event_id: null,
|
||||||
event_location_id: null,
|
event_location_id: null,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
2} | Loops: Active"
|
2} | Loops: Active"
|
||||||
>
|
>
|
||||||
<!-- Content omitted for brevity, preserved in file -->
|
<!-- 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">
|
<div class="grid grid-cols-1 gap-3">
|
||||||
<!-- Technical Timers (Edit Mode Only) -->
|
<!-- Technical Timers (Edit Mode Only) -->
|
||||||
{#if $ae_loc.edit_mode}
|
{#if $ae_loc.edit_mode}
|
||||||
@@ -34,8 +34,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.event
|
||||||
.check_event_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -47,8 +46,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.device
|
||||||
.check_event_device_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -60,8 +58,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.location
|
||||||
.check_event_location_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -73,8 +70,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.session
|
||||||
.check_event_session_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -86,8 +82,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.presentation
|
||||||
.check_event_presentation_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -99,8 +94,7 @@
|
|||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
bind:value={
|
bind:value={
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.presenter
|
||||||
.check_event_presenter_loop_period
|
|
||||||
}
|
}
|
||||||
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
class="input input-sm text-[10px] h-7 preset-tonal-surface"
|
||||||
/>
|
/>
|
||||||
@@ -144,7 +138,7 @@
|
|||||||
<span>Event Sync:</span>
|
<span>Event Sync:</span>
|
||||||
<span
|
<span
|
||||||
>{(
|
>{(
|
||||||
$ae_loc.native_device.check_event_loop_period /
|
$events_loc.launcher.sync_intervals.event /
|
||||||
1000
|
1000
|
||||||
).toFixed(1)}s</span
|
).toFixed(1)}s</span
|
||||||
>
|
>
|
||||||
@@ -155,8 +149,7 @@
|
|||||||
<span>Room Monitor:</span>
|
<span>Room Monitor:</span>
|
||||||
<span
|
<span
|
||||||
>{(
|
>{(
|
||||||
$ae_loc.native_device
|
$events_loc.launcher.sync_intervals.location / 1000
|
||||||
.check_event_location_loop_period / 1000
|
|
||||||
).toFixed(1)}s</span
|
).toFixed(1)}s</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,7 +158,7 @@
|
|||||||
>
|
>
|
||||||
<span>Prefix Sharding:</span>
|
<span>Prefix Sharding:</span>
|
||||||
<span
|
<span
|
||||||
>{$ae_loc.native_device.hash_prefix_length || 2} chars</span
|
>{$ae_loc.native_device?.hash_prefix_length || 2} chars</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
import { onMount, onDestroy } from 'svelte';
|
import { onMount, onDestroy } from 'svelte';
|
||||||
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
|
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 { events_func } from '$lib/ae_events_functions';
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { db_events } from '$lib/ae_events/db_events';
|
import { db_events } from '$lib/ae_events/db_events';
|
||||||
@@ -67,14 +67,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dev = $ae_loc.native_device || {};
|
const dev = $ae_loc.native_device || {};
|
||||||
|
const cfg = $events_loc.launcher.sync_intervals || {};
|
||||||
|
|
||||||
// Load timings from device config
|
// Load timings from persistent config, with fallbacks to device config or defaults
|
||||||
loop_info.event = dev.check_event_loop_period || 120000;
|
loop_info.event = cfg.event || dev.check_event_loop_period || 90000;
|
||||||
loop_info.device = dev.check_event_device_loop_period || 90000;
|
loop_info.device = cfg.device || dev.check_event_device_loop_period || 60000;
|
||||||
loop_info.location = dev.check_event_location_loop_period || 60000;
|
loop_info.location = cfg.location || dev.check_event_location_loop_period || 30000;
|
||||||
loop_info.session = dev.check_event_session_loop_period || 45000;
|
loop_info.session = cfg.session || dev.check_event_session_loop_period || 15000;
|
||||||
loop_info.presentation = dev.check_event_presentation_loop_period || 90000;
|
loop_info.presentation = cfg.presentation || dev.check_event_presentation_loop_period || 45000;
|
||||||
loop_info.presenter = dev.check_event_presenter_loop_period || 45000;
|
loop_info.presenter = cfg.presenter || dev.check_event_presenter_loop_period || 60000;
|
||||||
|
|
||||||
// 1. Structural/Metadata Loops
|
// 1. Structural/Metadata Loops
|
||||||
timer__event = setInterval(() => refresh_event_data(), loop_info.event);
|
timer__event = setInterval(() => refresh_event_data(), loop_info.event);
|
||||||
@@ -87,7 +88,7 @@
|
|||||||
timer__presenter = setInterval(() => refresh_presenter_data(), loop_info.presenter);
|
timer__presenter = setInterval(() => refresh_presenter_data(), loop_info.presenter);
|
||||||
|
|
||||||
// 3. Native File Sync Loop (Dexie -> Disk)
|
// 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);
|
timer__file_sync = setInterval(() => run_sync_cycle(), sync_period);
|
||||||
|
|
||||||
// Immediate first run for metadata
|
// Immediate first run for metadata
|
||||||
|
|||||||
Reference in New Issue
Block a user