mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
ircd:Ⓜ️:acquire: Fix fetching map critical emplacement.
This commit is contained in:
parent
cc1028bd8f
commit
55d5b4d1a7
4 changed files with 48 additions and 27 deletions
|
@ -127,7 +127,10 @@ struct ircd::m::acquire::opts
|
|||
|
||||
struct ircd::m::acquire::result
|
||||
{
|
||||
event::id::buf event_id;
|
||||
const m::vm::opts *vmopts {nullptr};
|
||||
ctx::future<fetch::result> future;
|
||||
event::id::buf event_id;
|
||||
|
||||
result(const vm::opts *, const event::id &, ctx::future<fetch::result> &&);
|
||||
result() = default;
|
||||
};
|
||||
|
|
|
@ -207,7 +207,7 @@ struct ircd::m::fetch::request
|
|||
m::room::id::buf room_id;
|
||||
|
||||
/// Internal
|
||||
request(const fetch::opts &);
|
||||
request(fetch::opts);
|
||||
request(request &&) = delete;
|
||||
request(const request &) = delete;
|
||||
request &operator=(request &&) = delete;
|
||||
|
|
|
@ -617,27 +617,23 @@ ircd::m::acquire::start(const m::event::id &event_id,
|
|||
const vm::opts *const &vmopts)
|
||||
try
|
||||
{
|
||||
assert(vmopts);
|
||||
|
||||
fetch::opts fopts;
|
||||
fopts.room_id = opts.room.room_id;
|
||||
fopts.event_id = event_id;
|
||||
fopts.backfill_limit = limit;
|
||||
fopts.op =
|
||||
(limit > 1 || hint)?
|
||||
fetch::op::backfill:
|
||||
fetch::op::event;
|
||||
|
||||
fopts.hint = hint;
|
||||
fopts.attempt_limit =
|
||||
!hint_only?
|
||||
opts.attempt_max:
|
||||
1U;
|
||||
|
||||
fetching.emplace_back(result
|
||||
const auto op
|
||||
{
|
||||
vmopts, fetch::start(fopts), event_id
|
||||
});
|
||||
limit > 1 || hint?
|
||||
fetch::op::backfill:
|
||||
fetch::op::event
|
||||
};
|
||||
|
||||
assert(vmopts);
|
||||
fetching.emplace_back(vmopts, event_id, fetch::start(
|
||||
{
|
||||
.op = op,
|
||||
.room_id = opts.room.room_id,
|
||||
.event_id = event_id,
|
||||
.hint = hint,
|
||||
.attempt_limit = !hint_only? opts.attempt_max: 1U,
|
||||
.backfill_limit = limit,
|
||||
}));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -778,3 +774,25 @@ const noexcept
|
|||
{
|
||||
return fetching.size() >= opts.fetch_width;
|
||||
}
|
||||
|
||||
//
|
||||
// result
|
||||
//
|
||||
|
||||
ircd::m::acquire::result::result(const m::vm::opts *const vmopts,
|
||||
const m::event::id &event_id,
|
||||
ctx::future<fetch::result> &&future)
|
||||
:event_id
|
||||
{
|
||||
event_id
|
||||
}
|
||||
,vmopts
|
||||
{
|
||||
vmopts
|
||||
}
|
||||
,future
|
||||
{
|
||||
std::move(future)
|
||||
}
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1104,22 +1104,22 @@ noexcept
|
|||
// request::request
|
||||
//
|
||||
|
||||
ircd::m::fetch::request::request(const fetch::opts &opts)
|
||||
ircd::m::fetch::request::request(fetch::opts opts)
|
||||
:opts
|
||||
{
|
||||
opts
|
||||
std::move(opts)
|
||||
}
|
||||
,buf
|
||||
{
|
||||
opts.bufsz?: 16_KiB
|
||||
this->opts.bufsz?: 16_KiB
|
||||
}
|
||||
,event_id
|
||||
{
|
||||
opts.event_id
|
||||
this->opts.event_id
|
||||
}
|
||||
,room_id
|
||||
{
|
||||
opts.room_id
|
||||
this->opts.room_id
|
||||
}
|
||||
{
|
||||
this->opts.event_id = this->event_id;
|
||||
|
|
Loading…
Reference in a new issue