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

ircd:Ⓜ️:fetch: Tweak conditions allowing requests based on runlevel.

This commit is contained in:
Jason Volk 2020-05-11 21:32:48 -07:00
parent ef80b1aff8
commit 3af0ebe53a

View file

@ -125,6 +125,11 @@ ircd::ctx::future<ircd::m::fetch::result>
ircd::m::fetch::start(opts opts)
{
assert(opts.room_id && opts.event_id);
if(unlikely(run::level == run::level::QUIT))
throw m::UNAVAILABLE
{
"Cannot start fetch requests at this time."
};
// in case requests are started before runlevel RUN they are stalled here
run::barrier<m::UNAVAILABLE>
@ -378,12 +383,6 @@ bool
ircd::m::fetch::start(request &request)
try
{
if(unlikely(run::level != run::level::RUN || ctx::termination(request_context)))
throw m::UNAVAILABLE
{
"Cannot start fetch requests at this time."
};
assert(!request.finished);
if(!request.started && !request.origin)
request.origin = request.opts.hint;
@ -424,14 +423,13 @@ ircd::m::fetch::start(request &request,
const string_view &remote)
try
{
assert(!request.finished);
if(unlikely(run::level != run::level::RUN))
throw m::UNAVAILABLE
{
"Cannot take requests in runlevel %s",
reflect(run::level),
"Cannot start fetch requests in runlevel."
};
assert(!request.finished);
request.last = ircd::now<system_point>();
if(!request.started)
request.started = request.last;