From d5b8260196f3e5e9b2d0799454c795c5f5b15fd3 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Tue, 1 Dec 2020 10:01:34 -0700 Subject: [PATCH] syncapi/requestpool: fix initial sync logic error in appendAccountData() (#1594) * 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. * syncapi/requestpool: reintroduce req.since == nil check --- syncapi/sync/requestpool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syncapi/sync/requestpool.go b/syncapi/sync/requestpool.go index 61f8c46f7..cb84c5bb6 100644 --- a/syncapi/sync/requestpool.go +++ b/syncapi/sync/requestpool.go @@ -328,7 +328,7 @@ 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 { + if req.since == nil || (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{