Fix complete sync positions

This commit is contained in:
Neil Alexander 2021-01-08 14:59:11 +00:00
parent 8fdcd97108
commit e5d7a00d82
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -29,16 +29,14 @@ func (p *PDUStreamProvider) CompleteSync(
ctx context.Context, ctx context.Context,
req *types.SyncRequest, req *types.SyncRequest,
) types.StreamPosition { ) types.StreamPosition {
from := types.StreamPosition(0)
to := p.LatestPosition(ctx) to := p.LatestPosition(ctx)
from := to - 20
if from < 0 {
from = 0
}
// Get the current sync position which we will base the sync response on. // Get the current sync position which we will base the sync response on.
r := types.Range{ r := types.Range{
From: from, From: to,
To: to, To: 0,
Backwards: true,
} }
// Extract room state and recent events for all rooms the user is joined to. // Extract room state and recent events for all rooms the user is joined to.