mirror of
https://github.com/matrix-construct/construct
synced 2024-06-16 08:58:20 +02:00
modules/m_user: Determine the best query pattern for highlight count based on cache.
This commit is contained in:
parent
88a633efdb
commit
61e3fa848c
|
@ -145,10 +145,13 @@ ircd::m::user::highlight::count_between(const m::room &room,
|
|||
const event::idx_range &range)
|
||||
const
|
||||
{
|
||||
static const event::fetch::opts fopts
|
||||
static const event::fetch::opts fopts{[]
|
||||
{
|
||||
event::keys::include {"type", "content"},
|
||||
};
|
||||
event::fetch::opts ret;
|
||||
ret.keys = event::keys::include {"type", "content"};
|
||||
ret.query_json_force = true;
|
||||
return ret;
|
||||
}()};
|
||||
|
||||
m::room::messages it
|
||||
{
|
||||
|
@ -177,7 +180,9 @@ const
|
|||
|
||||
size_t ret{0};
|
||||
for(++it; it && it.event_idx() < range.second; ++it)
|
||||
ret += has(*it);
|
||||
ret += cached(it.event_idx(), fopts)?
|
||||
has(*it):
|
||||
has(it.event_idx());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue