mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 01:16:19 +00:00
tornado: Cache messages internally in tornado process.
This allows us to handle the return_messages_immediately part of get_updates requests without having to talk to the database. (imported from commit ed0b7742d359efb21a0a4960f4fc25f4337e9ad4)
This commit is contained in:
@@ -8,6 +8,7 @@ from zephyr.models import Realm, Stream, UserProfile, \
|
||||
from django.db import transaction, IntegrityError
|
||||
from zephyr.lib.initial_password import initial_password
|
||||
from zephyr.lib.cache import cache_with_key
|
||||
from zephyr.lib.message_cache import cache_save_message
|
||||
from django.utils import timezone
|
||||
from django.contrib.auth.models import UserManager
|
||||
|
||||
@@ -145,6 +146,8 @@ def do_send_message(message, no_log=False):
|
||||
if user_profile.user.is_active:
|
||||
UserMessage(user_profile=user_profile, message=message).save()
|
||||
|
||||
cache_save_message(message)
|
||||
|
||||
# We can only publish messages to longpolling clients if the Tornado server is running.
|
||||
if settings.TORNADO_SERVER:
|
||||
# Render Markdown etc. here, so that the single-threaded Tornado server doesn't have to.
|
||||
|
||||
Reference in New Issue
Block a user