Send less presence info to Tornado in do_send_messages().

When we send a message, we send some presence information to Tornado
to help it figure out how to generate emails for idle recipients of
a message.  This change limits the presence info to being the
intersection of present users and recipients of the message.  It is
just an internal optimization to avoid queueing up unneeded data.

The history behind this feature is that I implemented it a while
back, but I think I made a rebase mistake that sent all the presence
data over the wire, despite having code to filter on recipients.
It was mostly harmless, just leading to some inefficiency which is
now fixed.

(imported from commit 7c8e97705afb299c67b99053909e952fbc823551)
This commit is contained in:
Steve Howell 2013-09-25 14:29:49 -04:00
parent e2126b78ab
commit 93347be4af
1 changed files with 1 additions and 1 deletions

View File

@ -318,7 +318,7 @@ def do_send_messages(messages):
data = dict(
type = 'new_message',
message = message['message'].id,
presences = user_presences,
presences = presences,
users = [{'id': user.id, 'flags': user_flags.get(user.id, [])}
for user in message['recipients']])
if message['message'].recipient.type == Recipient.STREAM: