mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 16:46:50 +01:00
ircd:Ⓜ️ Optimize user::rooms iteration event query.
This commit is contained in:
parent
2755d779c9
commit
bc26a8f9b3
1 changed files with 20 additions and 1 deletions
21
ircd/m/m.cc
21
ircd/m/m.cc
|
@ -2132,8 +2132,27 @@ ircd::m::user::rooms::for_each(const string_view &membership,
|
||||||
const closure_bool &closure)
|
const closure_bool &closure)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
|
// Setup the list of event fields to fetch for the closure
|
||||||
|
static const event::keys keys
|
||||||
|
{
|
||||||
|
event::keys::include
|
||||||
|
{
|
||||||
|
"event_id",
|
||||||
|
"state_key",
|
||||||
|
"content",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::event::fetch::opts fopts
|
||||||
|
{
|
||||||
|
keys, user_room.fopts? user_room.fopts->gopts : db::gopts{}
|
||||||
|
};
|
||||||
|
|
||||||
|
const m::room::state state
|
||||||
|
{
|
||||||
|
user_room, &fopts
|
||||||
|
};
|
||||||
|
|
||||||
const m::room::state state{user_room};
|
|
||||||
state.test("ircd.member", [&membership, &closure]
|
state.test("ircd.member", [&membership, &closure]
|
||||||
(const m::event &event)
|
(const m::event &event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue