0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 14:08:56 +02:00

ircd:Ⓜ️:fetch: Rename opts::limit to opts::backfill_limit.

This commit is contained in:
Jason Volk 2019-09-16 12:06:48 -07:00
parent a6efe6986c
commit 49ed79e9df
4 changed files with 15 additions and 11 deletions

View file

@ -77,11 +77,6 @@ struct ircd::m::fetch::opts
/// required, we'll try to use the top head from any room_id.
event::id event_id;
/// If the op makes use of a spec limit parameter that can be controlled
/// by the user here. The default of 0 will be replaced by some internal
/// configured limit like 8 or 16 etc.
size_t limit {0};
/// The principal allocation size. This is passed up the stack to m::fed,
/// server::request and ends up containing the request head and content,
/// and response head. The response content is usually dynamically
@ -96,6 +91,15 @@ struct ircd::m::fetch::opts
/// the normal room_id based operation is the fallback. If the room
/// is not known to us, it would be best to set this.
string_view hint;
//
// special options
//
/// If the op makes use of a spec limit parameter that can be controlled
/// by the user here. The default of 0 will be replaced by some internal
/// configured limit like 8 or 16 etc.
size_t backfill_limit {0};
};
struct ircd::m::fetch::result

View file

@ -485,7 +485,7 @@ try
v1::backfill::opts opts;
opts.remote = remote;
opts.dynamic = true;
opts.limit = request.opts.limit?: 64;
opts.limit = request.opts.backfill_limit?: 64;
opts.event_id = request.opts.event_id;
request.future = std::make_unique<v1::backfill>
(

View file

@ -481,7 +481,7 @@ try
opts.op = fetch::op::event;
opts.room_id = room_id;
opts.event_id = event_id;
opts.limit = 1;
opts.backfill_limit = 1;
opts.hint = hint;
auto future
{

View file

@ -636,9 +636,9 @@ ircd::m::vm::fetch::prev_fetch(const event &event,
opts.op = m::fetch::op::backfill;
opts.room_id = room.room_id;
opts.event_id = prev_id;
opts.limit = size_t(depth_gap);
opts.limit = std::min(opts.limit, eval.opts->fetch_prev_limit);
opts.limit = std::min(opts.limit, size_t(prev_backfill_limit));
opts.backfill_limit = size_t(depth_gap);
opts.backfill_limit = std::min(opts.backfill_limit, eval.opts->fetch_prev_limit);
opts.backfill_limit = std::min(opts.backfill_limit, size_t(prev_backfill_limit));
log::debug
{
log, "%s requesting backfill off %s; depth:%ld viewport:%ld room:%ld gap:%ld limit:%zu",
@ -648,7 +648,7 @@ ircd::m::vm::fetch::prev_fetch(const event &event,
viewport_depth,
room_depth,
depth_gap,
opts.limit,
opts.backfill_limit,
};
ret.emplace_front(m::fetch::start(opts));