Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

event_queue: Add TODO about duplicate notifications on GC sweep.

Prakhar Pratyusha68f5c9568d2
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 9bdec977272..e7c66eb3cc8 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -561,6 +561,13 @@ def do_gc_event_queues(
for realm_id in affected_realms:
filter_client_dict(realm_clients_all_streams, realm_id)
+ # TODO: If a user has multiple queues and all of them are being
+ # removed in the same sweep, `last_client_for_user` will be
+ # True for all of them, causing `missedmessage_hook` to enqueue
+ # duplicate notifications. Push notifications are deduplicated
+ # by the `active_mobile_push_notification` flag on UserMessage,
+ # but email notifications are not — duplicate
+ # ScheduledMessageNotificationEmail rows will be created.
for id in to_remove:
web_reload_clients.pop(id, None)
for cb in gc_hooks: