0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-20 17:01:55 +01:00

modules/client/sync/rooms/timeline: Add conf item for default limit.

This commit is contained in:
Jason Volk 2019-03-09 17:31:26 -08:00
parent 5cbc35298d
commit 79782958fc

View file

@ -21,6 +21,8 @@ namespace ircd::m::sync
static event::id::buf _room_timeline_polylog_events(data &, const m::room &, bool &, bool &);
static bool room_timeline_polylog(data &);
static bool room_timeline_linear(data &);
extern conf::item<size_t> limit_default;
extern const event::keys::include default_keys;
extern item room_timeline;
}
@ -48,6 +50,13 @@ ircd::m::sync::default_keys
"type",
};
decltype(ircd::m::sync::limit_default)
ircd::m::sync::limit_default
{
{ "name", "ircd.client.sync.rooms.timeline.limit.default" },
{ "default", 10L },
};
bool
ircd::m::sync::room_timeline_linear(data &data)
{
@ -148,14 +157,15 @@ ircd::m::sync::_room_timeline_polylog_events(data &data,
room, &fopts
};
for(; it && i < 10; --it, ++i)
const ssize_t limit(limit_default);
for(; it && i < limit; --it, ++i)
{
event_id = it.event_id();
if(!apropos(data, it.event_idx()))
break;
}
limited = i >= 10;
limited = i >= limit;
if(i > 0 && !it)
it.seek(event_id);