mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:fetch: Tweak conditions allowing requests based on runlevel.
This commit is contained in:
parent
ef80b1aff8
commit
3af0ebe53a
1 changed files with 7 additions and 9 deletions
|
@ -125,6 +125,11 @@ ircd::ctx::future<ircd::m::fetch::result>
|
||||||
ircd::m::fetch::start(opts opts)
|
ircd::m::fetch::start(opts opts)
|
||||||
{
|
{
|
||||||
assert(opts.room_id && opts.event_id);
|
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
|
// in case requests are started before runlevel RUN they are stalled here
|
||||||
run::barrier<m::UNAVAILABLE>
|
run::barrier<m::UNAVAILABLE>
|
||||||
|
@ -378,12 +383,6 @@ bool
|
||||||
ircd::m::fetch::start(request &request)
|
ircd::m::fetch::start(request &request)
|
||||||
try
|
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);
|
assert(!request.finished);
|
||||||
if(!request.started && !request.origin)
|
if(!request.started && !request.origin)
|
||||||
request.origin = request.opts.hint;
|
request.origin = request.opts.hint;
|
||||||
|
@ -424,14 +423,13 @@ ircd::m::fetch::start(request &request,
|
||||||
const string_view &remote)
|
const string_view &remote)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
assert(!request.finished);
|
||||||
if(unlikely(run::level != run::level::RUN))
|
if(unlikely(run::level != run::level::RUN))
|
||||||
throw m::UNAVAILABLE
|
throw m::UNAVAILABLE
|
||||||
{
|
{
|
||||||
"Cannot take requests in runlevel %s",
|
"Cannot start fetch requests in runlevel."
|
||||||
reflect(run::level),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(!request.finished);
|
|
||||||
request.last = ircd::now<system_point>();
|
request.last = ircd::now<system_point>();
|
||||||
if(!request.started)
|
if(!request.started)
|
||||||
request.started = request.last;
|
request.started = request.last;
|
||||||
|
|
Loading…
Reference in a new issue