mirror of
https://github.com/matrix-construct/construct
synced 2024-06-07 12:38:56 +02:00
ircd:Ⓜ️:room::head: Add room version hint to opts to reduce query.
This commit is contained in:
parent
275f5aa3cd
commit
8dfbe808d6
|
@ -89,4 +89,7 @@ struct ircd::m::room::head::generate::opts
|
|||
/// Requires that at least one reference is to an event created by this
|
||||
/// server (origin).
|
||||
bool need_my_head {false};
|
||||
|
||||
/// Hint the room version which determines the output format; avoid query.
|
||||
string_view version;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,8 @@ ircd::m::room::head::generate::generate(json::stack::array &out,
|
|||
char versionbuf[32];
|
||||
const auto version
|
||||
{
|
||||
m::version(versionbuf, head.room, std::nothrow)
|
||||
opts.version?:
|
||||
m::version(versionbuf, head.room, std::nothrow)
|
||||
};
|
||||
|
||||
// The output format depends on the room version; we select an output
|
||||
|
|
|
@ -212,9 +212,10 @@ ircd::m::vm::inject(eval &eval,
|
|||
{
|
||||
prev_buf, head,
|
||||
{
|
||||
16, // .limit = 16,
|
||||
true, // .need_top_head = true,
|
||||
true, // .need_my_head = false,
|
||||
16, // .limit = 16,
|
||||
true, // .need_top_head = true,
|
||||
true, // .need_my_head = false,
|
||||
eval.room_version // .version = eval.room_version,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue