mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
events: Do nothing in apply_event for restart events.
These signal that the Tornado process restarted, which in itself is not notable for apply_events.
This commit is contained in:
committed by
Tim Abbott
parent
802477ca1a
commit
c1aadbe52e
@@ -1531,6 +1531,9 @@ def apply_event(
|
|||||||
# possible, but the worst expected outcome is that the client
|
# possible, but the worst expected outcome is that the client
|
||||||
# retains the old JS instead of reloading.
|
# retains the old JS instead of reloading.
|
||||||
logging.warning("Got a web_reload_client event during apply_events")
|
logging.warning("Got a web_reload_client event during apply_events")
|
||||||
|
elif event["type"] == "restart":
|
||||||
|
# The Tornado process restarted. This has no effect; we ignore it.
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
raise AssertionError("Unexpected event type {}".format(event["type"]))
|
raise AssertionError("Unexpected event type {}".format(event["type"]))
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ from zerver.tornado.event_queue import (
|
|||||||
clear_client_event_queues_for_testing,
|
clear_client_event_queues_for_testing,
|
||||||
create_heartbeat_event,
|
create_heartbeat_event,
|
||||||
mark_clients_to_reload,
|
mark_clients_to_reload,
|
||||||
|
send_restart_events,
|
||||||
send_web_reload_client_events,
|
send_web_reload_client_events,
|
||||||
)
|
)
|
||||||
from zerver.views.realm_playgrounds import access_playground_by_id
|
from zerver.views.realm_playgrounds import access_playground_by_id
|
||||||
@@ -3478,6 +3479,13 @@ class NormalActionsTest(BaseAction):
|
|||||||
events = self.verify_action(lambda: do_set_zoom_token(self.user_profile, None))
|
events = self.verify_action(lambda: do_set_zoom_token(self.user_profile, None))
|
||||||
check_has_zoom_token("events[0]", events[0], value=False)
|
check_has_zoom_token("events[0]", events[0], value=False)
|
||||||
|
|
||||||
|
def test_restart_event(self) -> None:
|
||||||
|
self.verify_action(
|
||||||
|
lambda: send_restart_events(),
|
||||||
|
num_events=1,
|
||||||
|
state_change_expected=False,
|
||||||
|
)
|
||||||
|
|
||||||
def test_web_reload_client_event(self) -> None:
|
def test_web_reload_client_event(self) -> None:
|
||||||
self.verify_action(
|
self.verify_action(
|
||||||
lambda: send_web_reload_client_events(),
|
lambda: send_web_reload_client_events(),
|
||||||
|
|||||||
Reference in New Issue
Block a user