diff options
author | sergekh2 <104387024+sergekh2@users.noreply.github.com> | 2022-08-02 01:43:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 09:43:48 +0100 |
commit | 6b6b420b9f467d053fd1fe3d1872f94c0bcf8300 (patch) | |
tree | 2be212bfdaf3f690a14fedd7b7975f5e1c8e7242 /syncapi | |
parent | 3d51624fefa7f78833652e21760a75527dafce9b (diff) |
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.
Diffstat (limited to 'syncapi')
-rw-r--r-- | syncapi/streams/stream_pdu.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index 1832adbe..1003208f 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -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 } } |