Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
zulip_updates: Protect against race with ourself.
Tim Abbott5c5e6b8cc59a
diff --git a/zerver/lib/zulip_update_announcements.py b/zerver/lib/zulip_update_announcements.pyindex 873fdd94c48..fe25037b317 100644--- a/zerver/lib/zulip_update_announcements.py+++ b/zerver/lib/zulip_update_announcements.py@@ -193,7 +193,16 @@ def send_zulip_update_announcements(skip_delay: bool) -> None:)for realm in realms:+ # Refresh the realm from the database and check its+ # properties, to protect against racing with another copy of+ # ourself.+ realm.refresh_from_db()realm_zulip_update_announcements_level = realm.zulip_update_announcements_level+ assert (+ realm_zulip_update_announcements_level is None+ or realm_zulip_update_announcements_level < latest_zulip_update_announcements_level+ )+sender = get_system_bot(settings.NOTIFICATION_BOT, realm.id)messages = []