From 4c71394fe8d413e409ff8d2d4d781826dcf62d16 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 3 Nov 2021 09:48:46 +0000 Subject: [PATCH] Try not to handle so many state events --- syncapi/storage/shared/syncserver.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/syncapi/storage/shared/syncserver.go b/syncapi/storage/shared/syncserver.go index e6c68183..2d84fbcf 100644 --- a/syncapi/storage/shared/syncserver.go +++ b/syncapi/storage/shared/syncserver.go @@ -681,9 +681,12 @@ func (d *Database) GetStateDeltas( defer sqlutil.EndTransactionWithCheck(txn, &succeeded, &err) 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 - stateNeeded, eventMap, err := d.OutputEvents.SelectStateInRange(ctx, txn, r, stateFilter) + // Get the user's membership transitions for the rooms they are joined to. + stateNeeded, eventMap, err := d.OutputEvents.SelectStateInRange(ctx, txn, r, &memberStateFilter) if err != nil { return nil, nil, err }