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

modules/s_fetch: Condition fetch::start() on runlevel.

This commit is contained in:
Jason Volk 2019-04-12 14:15:06 -07:00
parent d090382551
commit 1dcd4c8eb6

View file

@ -548,6 +548,21 @@ IRCD_MODULE_EXPORT
ircd::m::fetch::start(const m::room::id &room_id,
const m::event::id &event_id)
{
ircd::run::changed::dock.wait([]
{
return run::level == run::level::RUN ||
run::level == run::level::QUIT;
});
if(unlikely(run::level != run::level::RUN))
throw m::UNAVAILABLE
{
"Cannot fetch %s in %s in runlevel '%s'",
string_view{event_id},
string_view{room_id},
reflect(run::level)
};
submit(event_id, room_id);
}