mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 15:33:30 +00:00
tornado: Send rendered messages to Tornado via memcached.
(imported from commit c1e8a017fa61b4e3f5c44ad4e5f59e4faf012ca3)
This commit is contained in:
@@ -150,14 +150,14 @@ def do_send_message(message, no_log=False):
|
||||
|
||||
# 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.
|
||||
# TODO: Reduce duplication in what we send.
|
||||
rendered = { 'text/html': message.to_dict(apply_markdown=True),
|
||||
'text/x-markdown': message.to_dict(apply_markdown=False) }
|
||||
# Render Markdown etc. here and store (automatically) in
|
||||
# memcached, so that the single-threaded Tornado server
|
||||
# doesn't have to.
|
||||
message.to_dict(apply_markdown=True)
|
||||
message.to_dict(apply_markdown=False)
|
||||
requests.post(settings.TORNADO_SERVER + '/notify_new_message', data=dict(
|
||||
secret = settings.SHARED_SECRET,
|
||||
message = message.id,
|
||||
rendered = simplejson.dumps(rendered),
|
||||
users = simplejson.dumps([str(user.id) for user in recipients])))
|
||||
|
||||
def create_stream_if_needed(realm, stream_name):
|
||||
|
||||
Reference in New Issue
Block a user