requestpool: fix initial sync logic error in appendAccountData()

In initial sync, req.since is no longer nil, but instead,
req.since.PDUPosition() and req.since.EDUPosition() returns 0.

This ensures forgotten rooms do not come back as zombies.
This commit is contained in:
Ariadne Conill 2020-11-21 19:59:07 +00:00
parent 9c52f82736
commit 16e3156260

View file

@ -328,7 +328,9 @@ func (rp *RequestPool) appendAccountData(
// data keys were set between two message. This isn't a huge issue since the
// duplicate data doesn't represent a huge quantity of data, but an optimisation
// here would be making sure each data is sent only once to the client.
if req.since == nil {
// TODO: We used to have req.since == nil here, is there any case where req.since
// can actually be nil?
if req.since.PDUPosition() == 0 && req.since.EDUPosition() == 0 {
// If this is the initial sync, we don't need to check if a data has
// already been sent. Instead, we send the whole batch.
dataReq := &userapi.QueryAccountDataRequest{