0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-25 21:38:18 +02:00

modules/m_room: Add a ctx yield interval in the state prefetch loop.

This commit is contained in:
Jason Volk 2018-10-27 14:03:32 -07:00
parent 806e1c95f7
commit 4a1df6af85

View file

@ -467,6 +467,13 @@ state__rebuild_history(const m::room &room)
return ret;
}
conf::item<ulong>
state__prefetch__yield_modulus
{
{ "name", "ircd.m.room.state_prefetch.yield_modulus" },
{ "default", 256L },
};
extern "C" size_t
state__prefetch(const m::room::state &state,
const string_view &type,
@ -491,6 +498,10 @@ state__prefetch(const m::room::state &state,
m::prefetch(event_idx, fopts);
++ret;
const ulong ym(state__prefetch__yield_modulus);
if(ym && ret % ym == 0)
ctx::yield();
}});
return ret;