Cancel existing get_updates requests before making a new one.

(imported from commit fdc1223acb0cbd92cc6e0cd83230db97b67ff5b4)
This commit is contained in:
Tim Abbott
2013-12-12 13:44:21 -05:00
parent 2aad7baac0
commit 7159564881

View File

@@ -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);
}