mirror of
https://github.com/matrix-construct/construct
synced 2024-11-12 13:01:07 +01:00
modules/m_user: Determine the best query pattern for highlight count based on cache.
This commit is contained in:
parent
88a633efdb
commit
61e3fa848c
1 changed files with 9 additions and 4 deletions
|
@ -145,10 +145,13 @@ ircd::m::user::highlight::count_between(const m::room &room,
|
||||||
const event::idx_range &range)
|
const event::idx_range &range)
|
||||||
const
|
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
|
m::room::messages it
|
||||||
{
|
{
|
||||||
|
@ -177,7 +180,9 @@ const
|
||||||
|
|
||||||
size_t ret{0};
|
size_t ret{0};
|
||||||
for(++it; it && it.event_idx() < range.second; ++it)
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue