From 2db24e28687e4c0b65bf67e799a19ebc4fff02b1 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Wed, 2 Sep 2026 18:46:12 +0100 Subject: [PATCH] Fix periodic rageshake log flush never running The throttled flush callback returned this.flush instead of calling it (regressed in #2607), so logs were only persisted to IndexedDB on rageshake submission or beforeunload. When the host removes the widget iframe at hangup, the whole call's logs were lost, so a rageshake filed from a later call carries nothing from the affected one. --- src/settings/rageshake.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/settings/rageshake.ts b/src/settings/rageshake.ts index b9ecbff50..8fe759a8c 100644 --- a/src/settings/rageshake.ts +++ b/src/settings/rageshake.ts @@ -204,10 +204,13 @@ class IndexedDBLogStore { // Throttled function to flush logs. We use throttle rather // than debounce as we want logs to be written regularly, otherwise // if there's a constant stream of logging, we'd never write anything. - private throttledFlush = throttle(() => this.flush, MAX_FLUSH_INTERVAL_MS, { - leading: false, - trailing: true, - }); + private throttledFlush = throttle( + () => { + this.flush().catch((e) => logger.error("Failed to flush logs", e)); + }, + MAX_FLUSH_INTERVAL_MS, + { leading: false, trailing: true }, + ); /** * Flush logs to disk.