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
F2164386: D8492.diff
Mon, Jul 1, 11:13 PM
Unknown Object (File)
Sun, Jun 30, 6:07 PM
Unknown Object (File)
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
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
Branch
michal/no-messages
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek added inline comments.
keyserver/src/fetchers/message-fetchers.js
443

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

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)