mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
Use throttle, not debounce, to "read" messages.
We were queuing up individual messages to be flagged as read on the server before this change, and we used debounce to avoid sending individual POSTs, but this created delays that were ripe for race conditions. Now we batch them in the caller and use throttle instead. This now prevents us from slamming the server with lots of individual requests, without as many opportunities for races. (Note that we still have some possibility of race conditions, but they should be rare now, and other commits will address some of the other contributors to read/unread glitches.)
This commit is contained in:
@@ -65,12 +65,13 @@ exports.mark_messages_as_read = function (messages, options) {
|
||||
return;
|
||||
}
|
||||
|
||||
message_flags.send_read(messages);
|
||||
|
||||
_.each(messages, function (message) {
|
||||
if (current_msg_list === message_list.narrowed) {
|
||||
unread.messages_read_in_narrow = true;
|
||||
}
|
||||
|
||||
message_flags.send_read(message);
|
||||
unread.mark_as_read(message.id);
|
||||
process_newly_read_message(message, options);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user