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.

cache: Properly flush stream from cache after the stream is deleted.

Vishnu KSb9066886d93e
diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py
index 330d19fb0cd..ea7ff1eb192 100644
--- a/zerver/lib/cache.py
+++ b/zerver/lib/cache.py
@@ -701,8 +701,12 @@ def flush_stream(sender: Any, **kwargs: Any) -> None:
stream = kwargs["instance"]
items_for_remote_cache = {}
- items_for_remote_cache[get_stream_cache_key(stream.name, stream.realm_id)] = (stream,)
- cache_set_many(items_for_remote_cache)
+
+ if kwargs.get("update_fields") is None:
+ cache_delete(get_stream_cache_key(stream.name, stream.realm_id))
+ else:
+ items_for_remote_cache[get_stream_cache_key(stream.name, stream.realm_id)] = (stream,)
+ cache_set_many(items_for_remote_cache)
if (
kwargs.get("update_fields") is None