mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
Cancel existing get_updates requests before making a new one.
(imported from commit fdc1223acb0cbd92cc6e0cd83230db97b67ff5b4)
This commit is contained in:
@@ -966,6 +966,13 @@ function get_updates(options) {
|
||||
get_updates_params.last_event_id = page_params.last_event_id;
|
||||
}
|
||||
|
||||
if (get_updates_xhr !== undefined) {
|
||||
get_updates_xhr.abort();
|
||||
}
|
||||
if (get_updates_timeout !== undefined) {
|
||||
clearTimeout(get_updates_timeout);
|
||||
}
|
||||
get_updates_timeout = undefined;
|
||||
get_updates_xhr = $.ajax({
|
||||
type: 'POST',
|
||||
url: '/json/get_events',
|
||||
@@ -1158,14 +1165,6 @@ function load_old_messages(opts) {
|
||||
}
|
||||
|
||||
function restart_get_updates(options) {
|
||||
if (get_updates_xhr !== undefined) {
|
||||
get_updates_xhr.abort();
|
||||
}
|
||||
|
||||
if (get_updates_timeout !== undefined) {
|
||||
clearTimeout(get_updates_timeout);
|
||||
}
|
||||
|
||||
get_updates(options);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user