tornado: Send rendered messages to Tornado via memcached.

(imported from commit c1e8a017fa61b4e3f5c44ad4e5f59e4faf012ca3)
This commit is contained in:
Tim Abbott
2013-01-10 15:08:02 -05:00
parent a058471a56
commit e36fd4b817
3 changed files with 5 additions and 20 deletions

View File

@@ -171,14 +171,6 @@ class Message(models.Model):
@cache_with_key(lambda self, apply_markdown: 'message_dict:%d:%d' % (self.id, apply_markdown))
def to_dict(self, apply_markdown):
# Messages arrive in the Tornado process with the dicts already rendered.
# This avoids running the Markdown parser and some database queries in the single-threaded
# Tornado server.
#
# This field is not persisted to the database and will disappear if the object is re-fetched.
if hasattr(self, 'precomputed_dicts'):
return self.precomputed_dicts['text/html' if apply_markdown else 'text/x-markdown']
display_recipient = get_display_recipient(self.recipient)
if self.recipient.type == Recipient.STREAM:
display_type = "stream"