mirror of https://github.com/zulip/zulip.git
89381a8072
We remove the cache functionality for the get_realm_stream function, and we also change it to return a thin Stream object (instead of calling select_related with no arguments). The main goal here is to remove code complexity, as we have been prone to at least one caching validation bug related to how Realm and UserGroup interact. That particular bug was more theoretical than practical in terms of its impact, to be clear. Even if we were to be perfectly disciplined about only caching thin stream objects and always making sure to delete cache entries when stream data changed, we would still be prone to ugly situations like having transactions get rolled back before we delete the cache entry. The do_deactivate_stream is a perfect example of where we have to consider the best time to unset the cache. If you unset it too early, then you are prone to races where somebody else churns the cache right before you update the database. If you set it too late, then you can have an invalid entry after a rollback or deadlock situation. If you just eliminate the cache as a moving part, that whole debate is moot. As the lack of test changes here indicates, we rarely fetch streams by name any more in critical sections of our code. The one place where we fetch by name is in loading the home page, but that is **only** when you specify a stream name. And, of course, that only causes about an extra millisecond of time. |
||
---|---|---|
.. | ||
__init__.py | ||
alert_words.py | ||
bots.py | ||
create_realm.py | ||
create_user.py | ||
custom_profile_fields.py | ||
default_streams.py | ||
hotspots.py | ||
invites.py | ||
message_delete.py | ||
message_edit.py | ||
message_flags.py | ||
message_send.py | ||
muted_users.py | ||
presence.py | ||
reactions.py | ||
realm_domains.py | ||
realm_emoji.py | ||
realm_export.py | ||
realm_icon.py | ||
realm_linkifiers.py | ||
realm_logo.py | ||
realm_playgrounds.py | ||
realm_settings.py | ||
scheduled_messages.py | ||
streams.py | ||
submessage.py | ||
typing.py | ||
uploads.py | ||
user_activity.py | ||
user_groups.py | ||
user_settings.py | ||
user_status.py | ||
user_topics.py | ||
users.py | ||
video_calls.py |