mirror of
https://github.com/matrix-construct/construct
synced 2025-02-16 16:50:12 +01:00
modules/s_fetch: Condition fetch::start() on runlevel.
This commit is contained in:
parent
d090382551
commit
1dcd4c8eb6
1 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue