If we're going backwards, update latestPosition

This commit is contained in:
Till Faelligen 2022-11-04 15:14:27 +01:00
parent b13cb43785
commit 7102be9d1c
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -264,6 +264,9 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
// Work out what the highest stream position is for all of the events in this
// room that were returned.
latestPosition := r.To
if r.Backwards {
latestPosition = r.From
}
updateLatestPosition := func(mostRecentEventID string) {
var pos types.StreamPosition
if _, pos, err = snapshot.PositionInTopology(ctx, mostRecentEventID); err == nil {