mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
modules/client/sync: Condition on conf items for prefetches of polylog state/timeline.
This commit is contained in:
parent
a24270d2bb
commit
18977fabe1
2 changed files with 28 additions and 7 deletions
|
@ -616,6 +616,20 @@ ircd::m::sync::linear::handle(client &client,
|
|||
// polylog
|
||||
//
|
||||
|
||||
ircd::conf::item<bool>
|
||||
ircd::m::sync::polylog::prefetch_state
|
||||
{
|
||||
{ "name", "ircd.client.sync.polylog.prefetch.state" },
|
||||
{ "default", true },
|
||||
};
|
||||
|
||||
ircd::conf::item<bool>
|
||||
ircd::m::sync::polylog::prefetch_timeline
|
||||
{
|
||||
{ "name", "ircd.client.sync.polylog.prefetch.timeline" },
|
||||
{ "default", true },
|
||||
};
|
||||
|
||||
bool
|
||||
ircd::m::sync::polylog::handle(client &client,
|
||||
shortpoll &sp,
|
||||
|
@ -897,14 +911,17 @@ ircd::m::sync::polylog::room_state(shortpoll &sp,
|
|||
room, &fopts
|
||||
};
|
||||
|
||||
state.for_each([&]
|
||||
(const m::event::idx &event_idx)
|
||||
if(bool(prefetch_state))
|
||||
{
|
||||
if(event_idx < sp.since || event_idx >= sp.current)
|
||||
return;
|
||||
state.for_each([&]
|
||||
(const m::event::idx &event_idx)
|
||||
{
|
||||
if(event_idx < sp.since || event_idx >= sp.current)
|
||||
return;
|
||||
|
||||
m::prefetch(event_idx, fopts);
|
||||
});
|
||||
m::prefetch(event_idx, fopts);
|
||||
});
|
||||
}
|
||||
|
||||
state.for_each([&]
|
||||
(const m::event &event)
|
||||
|
@ -1001,7 +1018,8 @@ ircd::m::sync::polylog::room_timeline_events(shortpoll &sp,
|
|||
if(it.event_idx() >= sp.current)
|
||||
break;
|
||||
|
||||
m::prefetch(it.event_idx(), fopts);
|
||||
if(bool(prefetch_timeline))
|
||||
m::prefetch(it.event_idx(), fopts);
|
||||
}
|
||||
|
||||
limited = i >= 10;
|
||||
|
|
|
@ -72,6 +72,9 @@ namespace ircd::m::sync::linear
|
|||
|
||||
namespace ircd::m::sync::polylog
|
||||
{
|
||||
extern conf::item<bool> prefetch_state;
|
||||
extern conf::item<bool> prefetch_timeline;
|
||||
|
||||
static void room_state(shortpoll &, json::stack::object &, const m::room &);
|
||||
static m::event::id::buf room_timeline_events(shortpoll &, json::stack::array &, const m::room &, bool &limited);
|
||||
static void room_timeline(shortpoll &, json::stack::object &, const m::room &);
|
||||
|
|
Loading…
Reference in a new issue