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
F3383728: D8492.id32492.diff
Thu, Nov 28, 5:27 PM
F3383437: D8492.diff
Thu, Nov 28, 3:34 PM
Unknown Object (File)
Mon, Nov 25, 2:56 PM
Unknown Object (File)
Mon, Nov 25, 2:59 AM
Unknown Object (File)
Mon, Nov 25, 2:58 AM
Unknown Object (File)
Mon, Nov 25, 2:21 AM
Unknown Object (File)
Sat, Nov 9, 5:53 PM
Unknown Object (File)
Sat, Nov 9, 2:34 PM
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)