mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Remove throttling of presence updates coming from server events.
Now that we're doing presence updates in a performant fashion, we don't need to throttle processing these events, and in fact the throttling of these events created a correctness problem, since we're now doing incremental updates rather than just rerendering everything after each event.
This commit is contained in:
@@ -45,7 +45,7 @@ activity.presence_info = {
|
||||
};
|
||||
|
||||
(function test_presence_list_full_update() {
|
||||
var users = activity._update_users();
|
||||
var users = activity.update_users();
|
||||
assert.deepEqual(users, [
|
||||
{ name: 'Fred Flintstone',
|
||||
email: 'fred@zulip.com',
|
||||
@@ -86,7 +86,7 @@ activity.presence_info = {
|
||||
};
|
||||
activity.presence_info['alice@zulip.com'] = users['alice@zulip.com'];
|
||||
|
||||
users = activity._update_users(users);
|
||||
users = activity.update_users(users);
|
||||
assert.deepEqual(users, [
|
||||
{ name: 'Alice Smith',
|
||||
email: 'alice@zulip.com',
|
||||
@@ -105,7 +105,7 @@ activity.presence_info = {
|
||||
'mark@zulip.com': {status: 'active'}
|
||||
};
|
||||
activity.presence_info['mark@zulip.com'] = users['mark@zulip.com'];
|
||||
users = activity._update_users(users);
|
||||
users = activity.update_users(users);
|
||||
assert.deepEqual(users, [
|
||||
{ name: 'Marky Mark',
|
||||
email: 'mark@zulip.com',
|
||||
|
||||
@@ -215,7 +215,7 @@ function filter_and_sort(users) {
|
||||
}
|
||||
exports._filter_and_sort = filter_and_sort;
|
||||
|
||||
function actually_update_users(user_list) {
|
||||
exports.update_users = function (user_list) {
|
||||
if (page_params.domain === 'mit.edu') {
|
||||
return; // MIT realm doesn't have a presence list
|
||||
}
|
||||
@@ -268,20 +268,10 @@ function actually_update_users(user_list) {
|
||||
|
||||
// Return updated users: useful for testing user performance fix
|
||||
return user_info;
|
||||
}
|
||||
exports._update_users = actually_update_users;
|
||||
|
||||
// The function actually_update_users() can be pretty expensive for realms with lots
|
||||
// of users. Not only is there more work to do in terms of rendering the user list, but
|
||||
// we also get more updates. Large realms have reported lags while typing in the compose
|
||||
// box, and there's strong evidence that this is caused by user list updates. This isn't a
|
||||
// perfect solution, but it should remove some pain, and there's no real harm in waiting five
|
||||
// seconds to update user activity.
|
||||
var update_users = _.throttle(actually_update_users, 5000);
|
||||
|
||||
};
|
||||
|
||||
function actually_update_users_for_search() {
|
||||
actually_update_users();
|
||||
exports.update_users();
|
||||
resize.resize_page_components();
|
||||
}
|
||||
|
||||
@@ -385,7 +375,7 @@ function focus_ping() {
|
||||
exports.presence_info[this_email] = status_from_timestamp(data.server_timestamp, presence);
|
||||
}
|
||||
});
|
||||
update_users();
|
||||
exports.update_users();
|
||||
exports.update_huddles();
|
||||
}
|
||||
});
|
||||
@@ -431,7 +421,7 @@ exports.set_user_statuses = function (users, server_time) {
|
||||
updated_users[email] = status;
|
||||
});
|
||||
|
||||
update_users(updated_users);
|
||||
exports.update_users(updated_users);
|
||||
exports.update_huddles();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user