From ba108eb9fcdb70305b1d2f857ae72a74c7893e54 Mon Sep 17 00:00:00 2001 From: "anton.buksa" Date: Mon, 9 Oct 2023 17:40:04 +0200 Subject: [PATCH] add 30 sec margin to ws last disconnect to account for timeouts Changelog: changed --- actions/websocket_actions.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/actions/websocket_actions.jsx b/actions/websocket_actions.jsx index 44b7c9d4ac..7d4d202546 100644 --- a/actions/websocket_actions.jsx +++ b/actions/websocket_actions.jsx @@ -390,10 +390,15 @@ function handleClose(failCount) { if (failCount > MAX_WEBSOCKET_FAILS) { dispatch(logError({type: 'critical', message: AnnouncementBarMessages.WEBSOCKET_PORT_ERROR}, true)); } + + // Subtract 30 sec to account for ws disconnection timeout + const nowTimestamp = Date.now(); + const thirtySecondsAgoTimestamp = nowTimestamp - (30 * 1000); + dispatch(batchActions([ { type: GeneralTypes.WEBSOCKET_FAILURE, - timestamp: Date.now(), + timestamp: thirtySecondsAgoTimestamp, }, incrementWsErrorCount(), ]));