Move data batch retrieval

This commit is contained in:
Brendan Abolivier 2017-07-31 16:17:36 +01:00
parent 2cdc3a0e07
commit 5aa58f924f
No known key found for this signature in database
GPG key ID: 8EF1500759F70623

View file

@ -123,14 +123,15 @@ func (rp *RequestPool) appendAccountData(
return nil, err
}
global, rooms, err := rp.accountDB.GetAccountData(localpart)
if err != nil {
return nil, err
}
if req.since == types.StreamPosition(0) {
// If this is the initial sync, we don't need to check if a data has
// already been sent
// already been sent. Instead, we send the whole batch.
var global []gomatrixserverlib.ClientEvent
var rooms map[string][]gomatrixserverlib.ClientEvent
global, rooms, err = rp.accountDB.GetAccountData(localpart)
if err != nil {
return nil, err
}
data.AccountData.Events = global
for r, j := range data.Rooms.Join {