Fix issue with sync API not advancing.
Issue: During conversation, under some conditions, sync cookie is not advanced, and, as a result, client loops on the same sync API call creating high traffic and CPU load.
Fix: pdu component of cookie was updated incorrectly.
@@ -261,9 +261,9 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
var pos types.StreamPosition
if _, pos, err = p.DB.PositionInTopology(ctx, mostRecentEventID); err == nil {
switch {
- case r.Backwards && pos > latestPosition:
+ case r.Backwards && pos < latestPosition:
fallthrough
- case !r.Backwards && pos < latestPosition:
+ case !r.Backwards && pos > latestPosition:
latestPosition = pos
}
}
