mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
modules/client/sync/rooms/account_data: Optimize w/ prefetch loop support.
This commit is contained in:
parent
a06e75c13c
commit
043b55afb7
1 changed files with 24 additions and 2 deletions
|
@ -34,6 +34,9 @@ ircd::m::sync::room_account_data
|
||||||
"rooms.account_data",
|
"rooms.account_data",
|
||||||
room_account_data_polylog,
|
room_account_data_polylog,
|
||||||
room_account_data_linear,
|
room_account_data_linear,
|
||||||
|
{
|
||||||
|
{ "prefetch", true }
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -203,6 +206,7 @@ ircd::m::sync::room_account_data_polylog(data &data)
|
||||||
bool ret{false};
|
bool ret{false};
|
||||||
ret |= room_account_data_polylog_events(data);
|
ret |= room_account_data_polylog_events(data);
|
||||||
ret |= room_account_data_polylog_tags(data);
|
ret |= room_account_data_polylog_tags(data);
|
||||||
|
assert(!ret || !data.prefetch);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,12 +233,18 @@ ircd::m::sync::room_account_data_polylog_events(data &data)
|
||||||
event::keys::include {"content"}
|
event::keys::include {"content"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(data.prefetch)
|
||||||
|
{
|
||||||
|
m::prefetch(event_idx, fopts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
m::event::fetch event
|
m::event::fetch event
|
||||||
{
|
{
|
||||||
std::nothrow, event_idx, fopts
|
std::nothrow, event_idx, fopts
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!event.valid)
|
if(unlikely(!event.valid))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
json::get<"state_key"_>(event) = state_key;
|
json::get<"state_key"_>(event) = state_key;
|
||||||
|
@ -298,6 +308,12 @@ ircd::m::sync::room_account_data_polylog_tags(data &data)
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ret{false};
|
bool ret{false};
|
||||||
|
if(data.prefetch)
|
||||||
|
{
|
||||||
|
data.user_state.prefetch(type);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
data.user_state.for_each(type, [&data, &tags, &ret]
|
data.user_state.for_each(type, [&data, &tags, &ret]
|
||||||
(const string_view &type, const string_view &state_key, const m::event::idx &event_idx)
|
(const string_view &type, const string_view &state_key, const m::event::idx &event_idx)
|
||||||
{
|
{
|
||||||
|
@ -310,12 +326,18 @@ ircd::m::sync::room_account_data_polylog_tags(data &data)
|
||||||
event::keys::include {"content"}
|
event::keys::include {"content"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(data.prefetch)
|
||||||
|
{
|
||||||
|
m::prefetch(event_idx, fopts);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const m::event::fetch event
|
const m::event::fetch event
|
||||||
{
|
{
|
||||||
std::nothrow, event_idx, fopts
|
std::nothrow, event_idx, fopts
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!event.valid)
|
if(unlikely(!event.valid))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
json::stack::member
|
json::stack::member
|
||||||
|
|
Loading…
Reference in a new issue