diff options
author | Till <2353100+S7evinK@users.noreply.github.com> | 2022-04-28 18:53:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-28 18:53:28 +0200 |
commit | 2a5b8e0306a283aa8ca64822d59d71479ffba59a (patch) | |
tree | ce014c70033cafc9afdb6db5959ba4d8672bd7df /syncapi/notifier | |
parent | c6ea2c9ff26ca6ae4c799db08a3f72c6b4d99256 (diff) |
Only load members of newly joined rooms (#2389)
* Only load members of newly joined rooms
* Comment that the query is prepared at runtime
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
Diffstat (limited to 'syncapi/notifier')
-rw-r--r-- | syncapi/notifier/notifier.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/syncapi/notifier/notifier.go b/syncapi/notifier/notifier.go index 82834239..87f0d86d 100644 --- a/syncapi/notifier/notifier.go +++ b/syncapi/notifier/notifier.go @@ -333,6 +333,20 @@ func (n *Notifier) Load(ctx context.Context, db storage.Database) error { return nil } +// LoadRooms loads the membership states required to notify users correctly. +func (n *Notifier) LoadRooms(ctx context.Context, db storage.Database, roomIDs []string) error { + n.lock.Lock() + defer n.lock.Unlock() + + roomToUsers, err := db.AllJoinedUsersInRoom(ctx, roomIDs) + if err != nil { + return err + } + n.setUsersJoinedToRooms(roomToUsers) + + return nil +} + // CurrentPosition returns the current sync position func (n *Notifier) CurrentPosition() types.StreamingToken { n.lock.RLock() |