mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-05 17:07:43 +00:00
perf+fix: debounce seq persistence + role changes, null-clear stale peer state
- server: SET_PEER_ROLE now uses the same per-room 500ms debounce as SET_CONTROL_MODE (M-4), preventing a buggy/malicious host from thrashing the room's UI with rapid promote/demote bursts. - server: PEER_STATUS relay treats explicit null as 'clear' for tabTitle/mediaTitle/currentTime, so the tab-close heartbeat actually zeroes out stale state on other peers instead of being silently preserved by the clamp fallback. - background: _persistLastSeq is now trailing-debounced (500ms), cutting storage.session IPC writes from one-per-relayed-event to one-per-quiet-window in active rooms. - locales: add missing TOAST_ID_REGENERATED to all 14 non-English locales (was blocking locale coverage test on main). - test: H-1 force-sync demote test now waits out the debounce window to reflect real-world UI timing (a host cannot promote, run a force-sync, and demote inside 500ms).
This commit is contained in:
@@ -245,6 +245,9 @@ try {
|
||||
await w(ho,'force_sync_prepare'); await w(hg,'force_sync_prepare');
|
||||
ho._m.length = hc._m.length = hg._m.length = 0;
|
||||
// owner demotes the co-host mid-flight — the EXECUTE must still go through.
|
||||
// Wait out the per-room role-change debounce (M-4) so this demote broadcasts:
|
||||
// in real usage the host can't promote, run a force-sync, and demote inside 500ms.
|
||||
await new Promise(r => setTimeout(r, 550));
|
||||
s(ho,'set_peer_role',{peerId:'cohost',controller:false});
|
||||
await w(hc,'control_mode');
|
||||
ho._m.length = hc._m.length = hg._m.length = 0;
|
||||
|
||||
Reference in New Issue
Block a user