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 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,26 @@
|
|||||||
2} | Loops: Active"
|
2} | Loops: Active"
|
||||||
>
|
>
|
||||||
<!-- Content omitted for brevity, preserved in file -->
|
<!-- Content omitted for brevity, preserved in file -->
|
||||||
|
<!-- Pause toggle: always visible — useful during testing or onsite troubleshooting -->
|
||||||
|
<div class="flex items-center justify-between mb-2 p-2 rounded border border-surface-500/10 bg-surface-500/5">
|
||||||
|
<span class="text-[10px] font-bold uppercase tracking-wider opacity-70">
|
||||||
|
{$events_loc.launcher.sync_paused ? '⏸ Sync Paused' : '▶ Sync Active'}
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={() => ($events_loc.launcher.sync_paused = !$events_loc.launcher.sync_paused)}
|
||||||
|
class="btn btn-xs transition-all"
|
||||||
|
class:preset-tonal-warning={$events_loc.launcher.sync_paused}
|
||||||
|
class:preset-tonal-success={!$events_loc.launcher.sync_paused}
|
||||||
|
>
|
||||||
|
{#if $events_loc.launcher.sync_paused}
|
||||||
|
<span class="fas fa-play mr-1"></span> Resume
|
||||||
|
{:else}
|
||||||
|
<span class="fas fa-pause mr-1"></span> Pause
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
{#if $events_loc.launcher.sync_intervals}
|
{#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) -->
|
||||||
|
|||||||
@@ -21,13 +21,16 @@
|
|||||||
let last_heartbeat: string | null = $state(null);
|
let last_heartbeat: string | null = $state(null);
|
||||||
|
|
||||||
// Loop Timings (Visible in UI)
|
// 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({
|
let loop_info = $state({
|
||||||
event: 90000,
|
event: 90000,
|
||||||
device: 60000,
|
device: 60000,
|
||||||
location: 30000,
|
location: 60000,
|
||||||
session: 15000,
|
session: 60000,
|
||||||
presentation: 45000,
|
presentation: 120000,
|
||||||
presenter: 60000
|
presenter: 120000
|
||||||
});
|
});
|
||||||
|
|
||||||
// Timer Handles
|
// Timer Handles
|
||||||
@@ -116,6 +119,7 @@
|
|||||||
* API Refresh: Event
|
* API Refresh: Event
|
||||||
*/
|
*/
|
||||||
async function refresh_event_data() {
|
async function refresh_event_data() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
if (!$events_slct.event_id) return;
|
if (!$events_slct.event_id) return;
|
||||||
try {
|
try {
|
||||||
await events_func.load_ae_obj_id__event({
|
await events_func.load_ae_obj_id__event({
|
||||||
@@ -134,6 +138,7 @@
|
|||||||
* API Refresh: Sessions in Room
|
* API Refresh: Sessions in Room
|
||||||
*/
|
*/
|
||||||
async function refresh_session_data() {
|
async function refresh_session_data() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
const location_id = $events_slct.event_location_id;
|
const location_id = $events_slct.event_location_id;
|
||||||
if (!location_id) return;
|
if (!location_id) return;
|
||||||
try {
|
try {
|
||||||
@@ -153,6 +158,7 @@
|
|||||||
* API Refresh: Presentations for Selected Session
|
* API Refresh: Presentations for Selected Session
|
||||||
*/
|
*/
|
||||||
async function refresh_presentation_data() {
|
async function refresh_presentation_data() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
const session_id = $events_slct.event_session_id;
|
const session_id = $events_slct.event_session_id;
|
||||||
if (!session_id) return;
|
if (!session_id) return;
|
||||||
try {
|
try {
|
||||||
@@ -171,6 +177,7 @@
|
|||||||
* API Refresh: Presenters for Selected Session
|
* API Refresh: Presenters for Selected Session
|
||||||
*/
|
*/
|
||||||
async function refresh_presenter_data() {
|
async function refresh_presenter_data() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
const session_id = $events_slct.event_session_id;
|
const session_id = $events_slct.event_session_id;
|
||||||
if (!session_id) return;
|
if (!session_id) return;
|
||||||
try {
|
try {
|
||||||
@@ -186,6 +193,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function run_sync_cycle() {
|
async function run_sync_cycle() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
const location_id = $events_slct.event_location_id;
|
const location_id = $events_slct.event_location_id;
|
||||||
const cache_root = $ae_loc.local_file_cache_path;
|
const cache_root = $ae_loc.local_file_cache_path;
|
||||||
const prefix_len = $ae_loc.native_device?.hash_prefix_length || 2;
|
const prefix_len = $ae_loc.native_device?.hash_prefix_length || 2;
|
||||||
@@ -373,6 +381,7 @@
|
|||||||
* Ensures we have latest room settings.
|
* Ensures we have latest room settings.
|
||||||
*/
|
*/
|
||||||
async function refresh_location_config() {
|
async function refresh_location_config() {
|
||||||
|
if ($events_loc.launcher.sync_paused) return;
|
||||||
const location_id = $events_slct.event_location_id;
|
const location_id = $events_slct.event_location_id;
|
||||||
if (!location_id) return;
|
if (!location_id) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user