0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

modules/client/sync: Enable polylog prefetch w/ conf item; add user::rooms prefetch.

This commit is contained in:
Jason Volk 2022-08-19 16:55:06 -07:00
parent e556fe248b
commit 53d213f956
2 changed files with 20 additions and 2 deletions

View file

@ -24,6 +24,7 @@ namespace ircd::m::sync
extern conf::item<size_t> buffer_size;
extern conf::item<size_t> linear_buffer_size;
extern conf::item<size_t> linear_delta_max;
extern conf::item<size_t> polylog_prefetch;
extern conf::item<bool> longpoll_enable;
extern conf::item<bool> polylog_phased;
extern conf::item<bool> polylog_only;
@ -133,6 +134,13 @@ ircd::m::sync::linear_delta_max
{ "help", linear_delta_max_help },
};
decltype(ircd::m::sync::polylog_prefetch)
ircd::m::sync::polylog_prefetch
{
{ "name", "ircd.client.sync.polylog.prefetch" },
{ "default", 8192 },
};
decltype(ircd::m::sync::polylog_phased)
ircd::m::sync::polylog_phased
{
@ -1036,8 +1044,15 @@ try
*data.out
};
// Prefetch loop
if(data.range.first == 0)
const bool prefetch
{
false
|| (data.range.first == 0 && bool(polylog_prefetch))
|| (data.range.second - data.range.first > size_t(polylog_prefetch))
};
// Branch to run a prefetch loop.
if(prefetch)
{
const scope_restore prefetching
{

View file

@ -141,6 +141,9 @@ ircd::m::sync::rooms_polylog(data &data)
bool ret{false};
int64_t phase(0);
if(data.prefetch)
data.user_rooms.prefetch();
ret |= _rooms_polylog(data, "join", phase);
if(data.phased && ret)
return ret;