mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Throttle user list updates to 5s intervals.
(imported from commit 908806d1ac00f14802f2a01a40d0abb66778a441)
This commit is contained in:
		@@ -150,7 +150,7 @@ function focus_lost() {
 | 
				
			|||||||
    exports.has_focus = false;
 | 
					    exports.has_focus = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function update_users() {
 | 
					function actually_update_users() {
 | 
				
			||||||
    if (page_params.domain === 'mit.edu') {
 | 
					    if (page_params.domain === 'mit.edu') {
 | 
				
			||||||
        return;  // MIT realm doesn't have a presence list
 | 
					        return;  // MIT realm doesn't have a presence list
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -196,6 +196,14 @@ function update_users() {
 | 
				
			|||||||
    compose_fade.update_faded_users();
 | 
					    compose_fade.update_faded_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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.update_huddles = function () {
 | 
					exports.update_huddles = function () {
 | 
				
			||||||
    if (page_params.domain === 'mit.edu') {
 | 
					    if (page_params.domain === 'mit.edu') {
 | 
				
			||||||
        return;  // MIT realm doesn't have a presence list
 | 
					        return;  // MIT realm doesn't have a presence list
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user