Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Defer cache invalidation to after transaction commit.
Alex Vandiver40e0114a0e99
diff --git a/zerver/actions/streams.py b/zerver/actions/streams.pyindex 0df045e1e95..3eea32f894b 100644--- a/zerver/actions/streams.py+++ b/zerver/actions/streams.py@@ -267,7 +267,9 @@ def do_unarchive_stream(stream: Stream, new_name: str, *, acting_user: UserProfirealm_id=realm.id,recipient_id=stream.recipient_id,).only("id")- cache_delete_many(to_dict_cache_key_id(message.id) for message in messages)+ transaction.on_commit(+ lambda: cache_delete_many(to_dict_cache_key_id(message.id) for message in messages)+ )# Unset the is_web_public and is_realm_public cache on attachments,# since the stream is now private.@@ -1522,7 +1524,9 @@ def do_rename_stream(stream: Stream, new_name: str, user_profile: UserProfile) -# Delete cache entries for everything else, which is cheaper and# clearer than trying to set them. display_recipient is the out of# date field in all cases.- cache_delete_many(to_dict_cache_key_id(message.id) for message in messages)+ transaction.on_commit(+ lambda: cache_delete_many(to_dict_cache_key_id(message.id) for message in messages)+ )# We want to key these updates by id, not name, since id is# the immutable primary key, and obviously name is not.