mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
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:
f207450cdb
This commit is contained in:
@@ -9,12 +9,6 @@ let get_events_timeout;
|
|||||||
let get_events_failures = 0;
|
let get_events_failures = 0;
|
||||||
const get_events_params = {};
|
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) {
|
function get_events_success(events) {
|
||||||
let messages = [];
|
let messages = [];
|
||||||
const update_message_events = [];
|
const update_message_events = [];
|
||||||
@@ -178,13 +172,6 @@ function get_events(options) {
|
|||||||
|
|
||||||
get_events_params.dont_block = options.dont_block || get_events_failures > 0;
|
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) {
|
if (get_events_params.queue_id === undefined) {
|
||||||
get_events_params.queue_id = page_params.queue_id;
|
get_events_params.queue_id = page_params.queue_id;
|
||||||
get_events_params.last_event_id = page_params.last_event_id;
|
get_events_params.last_event_id = page_params.last_event_id;
|
||||||
@@ -207,7 +194,6 @@ function get_events(options) {
|
|||||||
idempotent: true,
|
idempotent: true,
|
||||||
timeout: page_params.poll_timeout,
|
timeout: page_params.poll_timeout,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
exports.suspect_offline = false;
|
|
||||||
try {
|
try {
|
||||||
get_events_xhr = undefined;
|
get_events_xhr = undefined;
|
||||||
get_events_failures = 0;
|
get_events_failures = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user