From f4601f1258d57cd2af54a4fc756946fee376e59a Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Thu, 16 Feb 2023 12:09:51 -0500 Subject: [PATCH] fix(replay): Debounced flushes not respecting `maxWait` This is happening due to a bug in the `debounce` function where it does not respect `maxWait` if its value is the same as `wait`. This is causing poor fidelity in Replays and possibly memory issues if it never flushes after the initial checkout. --- packages/replay/src/constants.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/replay/src/constants.ts b/packages/replay/src/constants.ts index 87bf1823b056..85c482133ba9 100644 --- a/packages/replay/src/constants.ts +++ b/packages/replay/src/constants.ts @@ -22,7 +22,9 @@ export const MAX_SESSION_LIFE = 3_600_000; // 60 minutes /** Default flush delays */ export const DEFAULT_FLUSH_MIN_DELAY = 5_000; -export const DEFAULT_FLUSH_MAX_DELAY = 5_000; +// XXX: Temp fix for our debounce logic where `maxWait` would never occur if it +// was the same as `wait` +export const DEFAULT_FLUSH_MAX_DELAY = 5_500; /* How long to wait for error checkouts */ export const ERROR_CHECKOUT_TIME = 60_000;