Try not to handle so many state events

This commit is contained in:
Neil Alexander 2021-11-03 09:48:46 +00:00
parent dc06aec364
commit 4c71394fe8
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -681,9 +681,12 @@ func (d *Database) GetStateDeltas(
defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err) defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err)
var deltas []types.StateDelta var deltas []types.StateDelta
memberStateFilter := *stateFilter
memberStateFilter.Senders = []string{userID}
memberStateFilter.Types = []string{gomatrixserverlib.MRoomMember}
// get all the state events ever (i.e. for all available rooms) between these two positions // Get the user's membership transitions for the rooms they are joined to.
stateNeeded, eventMap, err := d.OutputEvents.SelectStateInRange(ctx, txn, r, stateFilter) stateNeeded, eventMap, err := d.OutputEvents.SelectStateInRange(ctx, txn, r, &memberStateFilter)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }