mirror of https://github.com/zulip/zulip.git
page_params: Move events_queue_expired to server_events.
This isn’t sent by the server; it’s a client-side global variable. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
bc8167db2a
commit
e8e7142ed1
|
@ -25,6 +25,8 @@ let get_events_timeout;
|
||||||
let get_events_failures = 0;
|
let get_events_failures = 0;
|
||||||
const get_events_params = {};
|
const get_events_params = {};
|
||||||
|
|
||||||
|
let event_queue_expired = false;
|
||||||
|
|
||||||
function get_events_success(events) {
|
function get_events_success(events) {
|
||||||
let messages = [];
|
let messages = [];
|
||||||
const update_message_events = [];
|
const update_message_events = [];
|
||||||
|
@ -208,7 +210,7 @@ function get_events({dont_block = false} = {}) {
|
||||||
// If we're old enough that our message queue has been
|
// If we're old enough that our message queue has been
|
||||||
// garbage collected, immediately reload.
|
// garbage collected, immediately reload.
|
||||||
if (xhr.status === 400 && xhr.responseJSON?.code === "BAD_EVENT_QUEUE_ID") {
|
if (xhr.status === 400 && xhr.responseJSON?.code === "BAD_EVENT_QUEUE_ID") {
|
||||||
page_params.event_queue_expired = true;
|
event_queue_expired = true;
|
||||||
reload.initiate({
|
reload.initiate({
|
||||||
immediate: true,
|
immediate: true,
|
||||||
save_pointer: false,
|
save_pointer: false,
|
||||||
|
@ -276,12 +278,12 @@ export function initialize() {
|
||||||
|
|
||||||
function cleanup_event_queue() {
|
function cleanup_event_queue() {
|
||||||
// Submit a request to the server to clean up our event queue
|
// Submit a request to the server to clean up our event queue
|
||||||
if (page_params.event_queue_expired === true || page_params.no_event_queue === true) {
|
if (event_queue_expired || page_params.no_event_queue) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
blueslip.log("Cleaning up our event queue");
|
blueslip.log("Cleaning up our event queue");
|
||||||
// Set expired because in a reload we may be called twice.
|
// Set expired because in a reload we may be called twice.
|
||||||
page_params.event_queue_expired = true;
|
event_queue_expired = true;
|
||||||
channel.del({
|
channel.del({
|
||||||
url: "/json/events",
|
url: "/json/events",
|
||||||
data: {queue_id: page_params.queue_id},
|
data: {queue_id: page_params.queue_id},
|
||||||
|
|
Loading…
Reference in New Issue