Skip to content

Commit

Permalink
Merge branch 'fix/last-disconnect-margin' into 'master'
Browse files Browse the repository at this point in the history
add 30 sec margin to ws last disconnect to account for timeouts

See merge request kchat/webapp!549
  • Loading branch information
antonbuks committed Oct 9, 2023
2 parents eb4dccb + ba108eb commit 0024ff9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion actions/websocket_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]));
Expand Down

0 comments on commit 0024ff9

Please sign in to comment.