mirror of https://github.com/zulip/zulip.git
zulip_updates: Protect against race with ourself.
This commit is contained in:
parent
5565bcf64f
commit
5c5e6b8cc5
|
@ -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 = []
|
||||
|
|
Loading…
Reference in New Issue