From 36aee9e69cfcebef186893a18e234f8d6d77ddf9 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Mon, 3 Feb 2020 14:13:10 +0000 Subject: [PATCH] presence: Remove suspect_offline flag. We now use user_ids for presence, so we don't need to worry about races related to unknown emails being sent to us. Now we just update the data structure based on user_id, and it will be there when we render the presence widget for that user_id, or else it will simply be ignored. It's not clear to me whether we still need dont_block here, so I didn't touch that code. Here is the commit that added the suspect_offline flag, for easy reference: f207450cdb8fca6f6385cb8e300cf31a3606d4fe --- static/js/server_events.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/static/js/server_events.js b/static/js/server_events.js index 57ab59b641..24d3a2b7d1 100644 --- a/static/js/server_events.js +++ b/static/js/server_events.js @@ -9,12 +9,6 @@ let get_events_timeout; let get_events_failures = 0; const get_events_params = {}; -// This field keeps track of whether we are attempting to -// force-reconnect to the events server due to suspecting we are -// offline. It is important for avoiding races with the presence -// system when coming back from unsuspend. -exports.suspect_offline = false; - function get_events_success(events) { let messages = []; const update_message_events = []; @@ -178,13 +172,6 @@ function get_events(options) { get_events_params.dont_block = options.dont_block || get_events_failures > 0; - if (get_events_params.dont_block) { - // If we're requesting an immediate re-connect to the server, - // that means it's fairly likely that this client has been off - // the Internet and thus may have stale state (which is - // important for potential presence issues). - exports.suspect_offline = true; - } if (get_events_params.queue_id === undefined) { get_events_params.queue_id = page_params.queue_id; get_events_params.last_event_id = page_params.last_event_id; @@ -207,7 +194,6 @@ function get_events(options) { idempotent: true, timeout: page_params.poll_timeout, success: function (data) { - exports.suspect_offline = false; try { get_events_xhr = undefined; get_events_failures = 0;