diff --git a/zerver/lib/cache.py b/zerver/lib/cache.py index c29df8264d..496e7c67be 100644 --- a/zerver/lib/cache.py +++ b/zerver/lib/cache.py @@ -289,7 +289,7 @@ def realm_alert_words_cache_key(realm): # Called by models.py to flush the stream cache whenever we save a stream # object. -def update_stream_cache(sender, **kwargs): +def flush_stream(sender, **kwargs): stream = kwargs['instance'] items_for_memcached = {} items_for_memcached[get_stream_cache_key(stream.name, stream.realm)] = (stream,) diff --git a/zerver/models.py b/zerver/models.py index 4614a0fcc6..bf8927584e 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -6,7 +6,7 @@ from django.contrib.auth.models import AbstractBaseUser, UserManager, \ PermissionsMixin from zerver.lib.cache import cache_with_key, flush_user_profile, flush_realm, \ user_profile_by_id_cache_key, user_profile_by_email_cache_key, \ - generic_bulk_cached_fetch, cache_set, update_stream_cache, \ + generic_bulk_cached_fetch, cache_set, flush_stream, \ display_recipient_cache_key, cache_delete, \ get_stream_cache_key, active_user_dicts_in_realm_cache_key from zerver.lib.utils import make_safe_digest, generate_random_token @@ -475,8 +475,8 @@ class Stream(models.Model): active=True ).count() -post_save.connect(update_stream_cache, sender=Stream) -post_delete.connect(update_stream_cache, sender=Stream) +post_save.connect(flush_stream, sender=Stream) +post_delete.connect(flush_stream, sender=Stream) def valid_stream_name(name): return name != ""