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:
@@ -21,13 +21,16 @@
|
||||
let last_heartbeat: string | null = $state(null);
|
||||
|
||||
// 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({
|
||||
event: 90000,
|
||||
device: 60000,
|
||||
location: 30000,
|
||||
session: 15000,
|
||||
presentation: 45000,
|
||||
presenter: 60000
|
||||
location: 60000,
|
||||
session: 60000,
|
||||
presentation: 120000,
|
||||
presenter: 120000
|
||||
});
|
||||
|
||||
// Timer Handles
|
||||
@@ -116,6 +119,7 @@
|
||||
* API Refresh: Event
|
||||
*/
|
||||
async function refresh_event_data() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
if (!$events_slct.event_id) return;
|
||||
try {
|
||||
await events_func.load_ae_obj_id__event({
|
||||
@@ -134,6 +138,7 @@
|
||||
* API Refresh: Sessions in Room
|
||||
*/
|
||||
async function refresh_session_data() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
const location_id = $events_slct.event_location_id;
|
||||
if (!location_id) return;
|
||||
try {
|
||||
@@ -153,6 +158,7 @@
|
||||
* API Refresh: Presentations for Selected Session
|
||||
*/
|
||||
async function refresh_presentation_data() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
const session_id = $events_slct.event_session_id;
|
||||
if (!session_id) return;
|
||||
try {
|
||||
@@ -171,6 +177,7 @@
|
||||
* API Refresh: Presenters for Selected Session
|
||||
*/
|
||||
async function refresh_presenter_data() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
const session_id = $events_slct.event_session_id;
|
||||
if (!session_id) return;
|
||||
try {
|
||||
@@ -186,6 +193,7 @@
|
||||
}
|
||||
|
||||
async function run_sync_cycle() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
const location_id = $events_slct.event_location_id;
|
||||
const cache_root = $ae_loc.local_file_cache_path;
|
||||
const prefix_len = $ae_loc.native_device?.hash_prefix_length || 2;
|
||||
@@ -373,6 +381,7 @@
|
||||
* Ensures we have latest room settings.
|
||||
*/
|
||||
async function refresh_location_config() {
|
||||
if ($events_loc.launcher.sync_paused) return;
|
||||
const location_id = $events_slct.event_location_id;
|
||||
if (!location_id) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user