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
Unknown Object (File)
Sat, Nov 9, 5:53 PM
Unknown Object (File)
Sat, Nov 9, 2:34 PM
Unknown Object (File)
Sat, Nov 9, 12:23 PM
Unknown Object (File)
Sat, Nov 9, 11:40 AM
Unknown Object (File)
Sat, Nov 9, 8:29 AM
Unknown Object (File)
Thu, Nov 7, 6:00 PM
Unknown Object (File)
Sep 29 2024, 8:42 PM
Unknown Object (File)
Sep 28 2024, 5:27 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
Branch
michal/last-message-v2
Lint
No Lint Coverage
Unit
No Test Coverage

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)