From babc28ccd0b8132b28fc7def8090b06194041dcf Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 4 Jul 2019 03:05:38 -0700 Subject: [PATCH] modules/client/sync/rooms/timeline: Add conf item for separate phased+initial limit. --- modules/client/sync/rooms/timeline.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/client/sync/rooms/timeline.cc b/modules/client/sync/rooms/timeline.cc index 8a1c99d45..4c8622ff9 100644 --- a/modules/client/sync/rooms/timeline.cc +++ b/modules/client/sync/rooms/timeline.cc @@ -27,6 +27,7 @@ namespace ircd::m::sync extern conf::item exposure_depth; extern conf::item exposure_state; extern conf::item limit_default; + extern conf::item limit_initial_default; extern const event::keys::include default_keys; extern item room_timeline; } @@ -64,6 +65,13 @@ ircd::m::sync::limit_default { "default", 10L }, }; +decltype(ircd::m::sync::limit_initial_default) +ircd::m::sync::limit_initial_default +{ + { "name", "ircd.client.sync.rooms.timeline.limit_initial.default" }, + { "default", 1L }, +}; + decltype(ircd::m::sync::exposure_state) ircd::m::sync::exposure_state { @@ -259,7 +267,13 @@ ircd::m::sync::_room_timeline_polylog_events(data &data, }; ssize_t i(0); - const ssize_t limit(limit_default); + const ssize_t limit + { + data.phased && data.range.first == 0? + ssize_t(limit_initial_default): // phased + initial=true + ssize_t(limit_default) + }; + for(; it && i <= limit; --it) { if(!i && it.event_idx() >= data.range.second)