0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️:room::state: Hoist event::fetch instance for faster seek in rebuilder.

This commit is contained in:
Jason Volk 2020-12-06 12:01:28 -08:00
parent 3b351b30f0
commit 3b0f2b7ad5

View file

@ -942,16 +942,12 @@ ircd::m::room::state::rebuild::rebuild(const room::id &room_id)
*m::dbs::events *m::dbs::events
}; };
ssize_t deleted(0); m::event::fetch event;
present_state.for_each([&opts, &txn, &deleted] ssize_t added(0), deleted(0);
present_state.for_each([&opts, &txn, &deleted, &event]
(const auto &type, const auto &state_key, const auto &event_idx) (const auto &type, const auto &state_key, const auto &event_idx)
{ {
const m::event::fetch &event if(!seek(std::nothrow, event, event_idx))
{
std::nothrow, event_idx
};
if(!event.valid)
return true; return true;
auto _opts(opts); auto _opts(opts);
@ -962,16 +958,10 @@ ircd::m::room::state::rebuild::rebuild(const room::id &room_id)
return true; return true;
}); });
ssize_t added(0); history.for_each([&opts, &txn, &added, &room_id, &check_auth, &event]
history.for_each([&opts, &txn, &added, &room_id, &check_auth]
(const auto &type, const auto &state_key, const auto &depth, const auto &event_idx) (const auto &type, const auto &state_key, const auto &depth, const auto &event_idx)
{ {
const m::event::fetch &event if(!seek(std::nothrow, event, event_idx))
{
std::nothrow, event_idx
};
if(!event.valid)
return true; return true;
const auto &[pass, fail] const auto &[pass, fail]