zulip/zerver/actions
Steve Howell 89381a8072 cache: Eliminate get-stream-by-name cache.
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.
2023-07-11 13:45:40 -07:00
..
__init__.py
alert_words.py actions: Split out zerver.actions.alert_words. 2022-04-14 17:14:31 -07:00
bots.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
create_realm.py create_realm: Remove unused argument from do_create_realm. 2023-05-11 12:13:50 -07:00
create_user.py user_groups: Audit UserGroup memberships changes. 2023-07-11 08:56:55 -07:00
custom_profile_fields.py markdown: Pass realm down into render_stream_description. 2022-11-01 08:20:47 -07:00
default_streams.py default stream groups: Make deleting streams efficient. 2023-07-10 13:41:28 -07:00
hotspots.py actions: Split out zerver.actions.hotspots. 2022-04-14 17:14:31 -07:00
invites.py emails: Add corporate_enabled to context for emails. 2023-05-01 10:32:43 -07:00
message_delete.py zerver: Update comments with "private message" or "PM". 2023-06-23 11:24:13 -07:00
message_edit.py mention: Replace 'wildcards' with 'stream_wildcards'. 2023-07-03 22:03:17 -07:00
message_flags.py Remove statsd support. 2023-04-25 19:58:16 -07:00
message_send.py mention: Replace 'wildcards' with 'stream_wildcards'. 2023-07-03 22:03:17 -07:00
muted_users.py muted users: Make file naming consistent. 2023-02-10 15:39:57 -08:00
presence.py presence: Support null values in UserPresence. 2023-04-26 14:26:47 -07:00
reactions.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_domains.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_emoji.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_export.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_icon.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_linkifiers.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_logo.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_playgrounds.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
realm_settings.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
scheduled_messages.py scheduled-messages: Split out edit scheduled message endpoint. 2023-05-26 18:05:55 -07:00
streams.py cache: Eliminate get-stream-by-name cache. 2023-07-11 13:45:40 -07:00
submessage.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
typing.py black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
uploads.py scheduled_message: Handle attachments properly. 2023-05-08 09:56:02 -07:00
user_activity.py Remove statsd support. 2023-04-25 19:58:16 -07:00
user_groups.py user_groups: Audit UserGroup group based setting changes. 2023-07-11 08:56:55 -07:00
user_settings.py django_api: Extract send_event_on_commit helper. 2023-06-19 13:42:40 -07:00
user_status.py user-status: Stop updating the UserStatus model for `away` updates. 2022-09-23 12:27:54 -07:00
user_topics.py user_topics: Update 'set visibility policy' codepath for bulk db operations. 2023-03-29 09:50:06 -07:00
users.py user_groups: Audit UserGroup memberships changes. 2023-07-11 08:56:55 -07:00
video_calls.py