HomePhabricator
Diffusion Comm 362a843ed259

[server] Don't unset TRUNCATED if threadCursor is null

Description

[server] Don't unset TRUNCATED if threadCursor is null

Summary:
While working on the previous diff, I noticed an issue here. Before D3351/D3352, we didn't actually use fetchMostRecentMessages anywhere in the codebase, which meant that we never set a threadCursor to null.

Now that we're actually using null threadCursors, we need to consider how they're handled here. In this particular case, we have some logic to unset TRUNCATED on the assumption that the result set is contiguous.

I don't think we can or should assume that for fetchMostRecentMessages. Instead, I think we should set TRUNCATED so that the MessageStore for that thread gets cleared, since we can't guarantee that whatever is currently in the MessageStore will be contiguous with the most recent messages.

Test Plan:

  1. I tested different values of defaultMaxMessageAge such that some threads would return fewer than defaultNumberPerThread, and some threads would return 0
  2. I tested threads that needed a fetchMostRecentMessages, and threads that needed multiple fetchMessagesBeforeCursor to get to the start
  3. I made sure all threads loaded all the way to the start of a thread if I kept scrolling

Reviewers: palys-swm, atul

Reviewed By: palys-swm

Subscribers: Adrian, karol-bisztyga, benschac

Differential Revision: https://phabricator.ashoat.com/D3411

Details

Provenance
ashoatAuthored on Mar 11 2022, 11:10 AM
Reviewer
tomek
Differential Revision
D3411: [server] Don't unset TRUNCATED if threadCursor is null
Parents
rCOMMbbd00893ebcb: [server] Don't set EXHAUSTIVE when there is a time filter
Branches
Unknown
Tags
Unknown