Only apply receipts on initial sync or if edu positions differ,

otherwise we'll be sending the same receipts over and over again.
This commit is contained in:
Till Faelligen 2020-10-20 11:01:07 +02:00
parent 3a5c8256df
commit 02a11d5a8f

View file

@ -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