mirror of https://github.com/zulip/zulip.git
cache: Fix the select_related() query name for sending_client.
Previously we were calling select_related() on Message.client, which doesn't exist. It seems kinda poor that this doesn't raise an exception. I believe this issue was causing us to do very large numbers of database queries during get_updates calls during server restarts. (imported from commit b79bd698820fbd9dd82bd61fc175c32cd5ce6d05)
This commit is contained in:
parent
e080be82fb
commit
d88591c19c
|
@ -13,12 +13,12 @@ def cache_save_message(message):
|
|||
|
||||
@cache_with_key(message_cache_key)
|
||||
def cache_get_message(message_id):
|
||||
return Message.objects.select_related("client", "sender").get(id=message_id)
|
||||
return Message.objects.select_related("sending_client", "sender").get(id=message_id)
|
||||
|
||||
# Called on Tornado startup to ensure our message cache isn't empty
|
||||
def populate_message_cache():
|
||||
items_for_memcached = {}
|
||||
for m in Message.objects.select_related("sender", "client").all().order_by(
|
||||
for m in Message.objects.select_related("sending_client", "sender").all().order_by(
|
||||
"-id")[0:MESSAGE_CACHE_SIZE]:
|
||||
items_for_memcached[message_cache_key(m.id)] = (m,)
|
||||
|
||||
|
|
Loading…
Reference in New Issue