diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-02-17 13:53:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-17 13:53:48 +0000 |
commit | 7dfc7c3d7067c0f247f79f299e80e100244f5121 (patch) | |
tree | e6db1e027ffecb06cbce4a3bea0d8fa86db5ecaf /roomserver/storage/shared/room_updater.go | |
parent | 353168a9e93803bc9c5608d2e0ec55ba7fc581d9 (diff) |
Don't re-send sent events in `add_state_events` (#2195)
* Only add events to `add_state_events` that haven't already been sent to the roomserver output before
* Filter on event NIDs instead, hopefully bring joy to SQLite
* UnsentFilter, review comments
Diffstat (limited to 'roomserver/storage/shared/room_updater.go')
-rw-r--r-- | roomserver/storage/shared/room_updater.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/roomserver/storage/shared/room_updater.go b/roomserver/storage/shared/room_updater.go index 89b878b9..810a18ef 100644 --- a/roomserver/storage/shared/room_updater.go +++ b/roomserver/storage/shared/room_updater.go @@ -215,7 +215,13 @@ func (u *RoomUpdater) EventIDs( func (u *RoomUpdater) EventNIDs( ctx context.Context, eventIDs []string, ) (map[string]types.EventNID, error) { - return u.d.eventNIDs(ctx, u.txn, eventIDs) + return u.d.eventNIDs(ctx, u.txn, eventIDs, NoFilter) +} + +func (u *RoomUpdater) UnsentEventNIDs( + ctx context.Context, eventIDs []string, +) (map[string]types.EventNID, error) { + return u.d.eventNIDs(ctx, u.txn, eventIDs, FilterUnsentOnly) } func (u *RoomUpdater) StateAtEventIDs( @@ -231,7 +237,11 @@ func (u *RoomUpdater) StateEntriesForEventIDs( } func (u *RoomUpdater) EventsFromIDs(ctx context.Context, eventIDs []string) ([]types.Event, error) { - return u.d.eventsFromIDs(ctx, u.txn, eventIDs) + return u.d.eventsFromIDs(ctx, u.txn, eventIDs, false) +} + +func (u *RoomUpdater) UnsentEventsFromIDs(ctx context.Context, eventIDs []string) ([]types.Event, error) { + return u.d.eventsFromIDs(ctx, u.txn, eventIDs, true) } func (u *RoomUpdater) GetMembershipEventNIDsForRoom( |