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, Dec 7, 1:49 PM
Unknown Object (File)
Thu, Dec 5, 6:21 AM
Unknown Object (File)
Sat, Nov 30, 5:19 PM
Unknown Object (File)
Thu, Nov 28, 5:27 PM
Unknown Object (File)
Thu, Nov 28, 3:34 PM
Unknown Object (File)
Nov 25 2024, 2:56 PM
Unknown Object (File)
Nov 25 2024, 2:59 AM
Unknown Object (File)
Nov 25 2024, 2:58 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/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)