mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
Fix most unnecessary database queries in huddle creation.
This saves 2 database queries per user in the huddle when sending the first message to a particular huddle. (imported from commit f71aa32df846fb4b82651a93ff9608087ffcaa5a)
This commit is contained in:
@@ -4,7 +4,8 @@ from zephyr.lib.context_managers import lockfile
|
||||
from zephyr.models import Realm, Stream, UserProfile, UserActivity, \
|
||||
Subscription, Recipient, Message, UserMessage, valid_stream_name, \
|
||||
DefaultStream, StreamColor, UserPresence, MAX_SUBJECT_LENGTH, \
|
||||
MAX_MESSAGE_LENGTH, get_client, get_stream, get_recipient, get_huddle
|
||||
MAX_MESSAGE_LENGTH, get_client, get_stream, get_recipient, get_huddle, \
|
||||
get_user_profile_by_id
|
||||
from django.db import transaction, IntegrityError
|
||||
from django.db.models import F
|
||||
from django.core.exceptions import ValidationError
|
||||
@@ -130,10 +131,6 @@ def log_message(message):
|
||||
if not message.sending_client.name.startswith("test:"):
|
||||
log_event(message.to_log_dict())
|
||||
|
||||
@cache_with_key(user_profile_by_id_cache_key)
|
||||
def get_user_profile_by_id(uid):
|
||||
return UserProfile.objects.select_related().get(id=uid)
|
||||
|
||||
def do_send_message(message, rendered_content=None, no_log=False,
|
||||
stream=None):
|
||||
# Log the message to our message log for populate_db to refill
|
||||
|
||||
Reference in New Issue
Block a user