0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-15 20:13:42 +01:00

Fix issue with sync API not advancing. (#2603)

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.
This commit is contained in:
sergekh2 2022-08-02 01:43:48 -07:00 committed by GitHub
parent 3d51624fef
commit 6b6b420b9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -261,9 +261,9 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
var pos types.StreamPosition var pos types.StreamPosition
if _, pos, err = p.DB.PositionInTopology(ctx, mostRecentEventID); err == nil { if _, pos, err = p.DB.PositionInTopology(ctx, mostRecentEventID); err == nil {
switch { switch {
case r.Backwards && pos > latestPosition: case r.Backwards && pos < latestPosition:
fallthrough fallthrough
case !r.Backwards && pos < latestPosition: case !r.Backwards && pos > latestPosition:
latestPosition = pos latestPosition = pos
} }
} }