Page MenuHomePhabricator

[keyserver] Always fetch the latest message for threads
ClosedPublic

Authored by michal on Jul 13 2023, 3:00 AM.
Tags
None
Referenced Files
F2142889: D8492.id28669.diff
Sat, Jun 29, 3:18 PM
Unknown Object (File)
Wed, Jun 26, 7:15 PM
Unknown Object (File)
Tue, Jun 25, 9:01 PM
Unknown Object (File)
Sun, Jun 23, 4:37 PM
Unknown Object (File)
Sat, Jun 22, 11:33 PM
Unknown Object (File)
Wed, Jun 12, 11:28 AM
Unknown Object (File)
Fri, Jun 7, 3:35 PM
Unknown Object (File)
Thu, Jun 6, 9:45 AM
Subscribers

Details

Summary

ENG-891

We can efficiently fetch the latest message for each thread using the memberships.last_message column. Thanks to this we should get correct message preview and thread ordering in thread list.

NOTE: the no messages issue still can happen in the genesis chat because of ENG-4101
Test Plan
  • tested on mobile and web and checked if the messages previews are correctly displayed
  • checked that the only code paths that are changed by this diff is website-responders and login/register. Other methods that fetch messages are not affected
  • the query was tested on prod db and the time was similar, so performance shouldn't be an issue

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek added inline comments.
keyserver/src/fetchers/message-fetchers.js
443 ↗(On Diff #28669)

Do we know if this query uses indices?

This revision is now accepted and ready to land.Jul 17 2023, 4:54 AM
keyserver/src/fetchers/message-fetchers.js
443 ↗(On Diff #28669)

I've run EXPLAIN on the whole fetchMessages query and it looks like the indices don't changes (in case of the messages table it's still thread)