performance: Avoid Recipient lookup for stream messages.

All the fields of a stream's recipient object can
be inferred from the Stream, so we just make a local
object.  Django will create a Message object without
checking that the child Recipient object has been
saved.  If that behavior changes in some upgrade,
we should see some pretty obvious symptom, including
query counts changing.

Tweaked by tabbott to add a longer explanatory comment, and delete a
useless old comment.
This commit is contained in:
Steve Howell
2020-10-19 19:49:36 +00:00
committed by Tim Abbott
parent 7bbcc2ac96
commit 85ed6f332a
4 changed files with 17 additions and 6 deletions

View File

@@ -1194,7 +1194,7 @@ class StreamMessagesTest(ZulipTestCase):
body=content,
)
self.assert_length(queries, 14)
self.assert_length(queries, 13)
def test_stream_message_dict(self) -> None:
user_profile = self.example_user('iago')