From 02a11d5a8f4b868ed1734f3a203f88a99de978ed Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 20 Oct 2020 11:01:07 +0200 Subject: [PATCH] Only apply receipts on initial sync or if edu positions differ, otherwise we'll be sending the same receipts over and over again. --- syncapi/storage/shared/syncserver.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go index d83a6c13d..3bd221b9e 100644 --- a/syncapi/storage/shared/syncserver.go +++ b/syncapi/storage/shared/syncserver.go @@ -633,9 +633,12 @@ func (d *Database) addEDUDeltaToResponse( } } - // always check for receipt deltas; otherwise an initial sync won't receive receipts - if err := d.addReceiptDeltaToResponse(fromPos, joinedRoomIDs, res); err != nil { - return errors.Wrap(err, "unable to apply receipts to response") + // Check on initial sync and if EDUPositions differ + if (fromPos.EDUPosition() == 0 && toPos.EDUPosition() == 0) || + fromPos.EDUPosition() != toPos.EDUPosition() { + if err := d.addReceiptDeltaToResponse(fromPos, joinedRoomIDs, res); err != nil { + return errors.Wrap(err, "unable to apply receipts to response") + } } return nil