fix: correctly clear after a request when an exception has been thrown
This commit is contained in:
parent
dda325bbbf
commit
1655ae3562
|
@ -765,26 +765,13 @@ void App::ProcessRequestThrow()
|
||||||
|
|
||||||
|
|
||||||
void App::ProcessRequest()
|
void App::ProcessRequest()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
system.load_avg.StartRequest(cur.request);
|
system.load_avg.StartRequest(cur.request);
|
||||||
log << log2 << config.log_delimiter << logend;
|
log << log2 << config.log_delimiter << logend;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
ProcessRequestThrow();
|
ProcessRequestThrow();
|
||||||
|
|
||||||
if( cur.request->run_state == Request::RunState::normal_run )
|
|
||||||
{
|
|
||||||
cur.request->FinishRequest();
|
|
||||||
system.load_avg.StopRequest(cur.request);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveSessionsIfNeeded();
|
|
||||||
|
|
||||||
if( cur.request->run_state == Request::RunState::finished )
|
|
||||||
{
|
|
||||||
ClearAfterRequest();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(const std::exception & e)
|
catch(const std::exception & e)
|
||||||
{
|
{
|
||||||
|
@ -798,12 +785,37 @@ void App::ProcessRequest()
|
||||||
{
|
{
|
||||||
log << log1 << "App: there was an unknown exception" << logend;
|
log << log1 << "App: there was an unknown exception" << logend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( cur.request->run_state == Request::RunState::normal_run )
|
||||||
|
{
|
||||||
|
cur.request->FinishRequest();
|
||||||
|
system.load_avg.StopRequest(cur.request);
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveSessionsIfNeeded();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
log << log1 << "App: an exception when finishing a request" << logend;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( cur.request->run_state == Request::RunState::finished )
|
||||||
|
{
|
||||||
|
ClearAfterRequest();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
log << log1 << "App: an exception when clearing after a request" << logend;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void App::ClearAfterRequest()
|
void App::ClearAfterRequest()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// simple operations which should not throw an exception
|
// simple operations which should not throw an exception
|
||||||
cur.request->Clear();
|
cur.request->Clear();
|
||||||
|
@ -819,11 +831,6 @@ void App::ClearAfterRequest()
|
||||||
|
|
||||||
log << logendrequest;
|
log << logendrequest;
|
||||||
}
|
}
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
log << log1 << "App: an exception when clearing after a request" << logend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool App::InitializeRequestForFastCGI(Request & request)
|
bool App::InitializeRequestForFastCGI(Request & request)
|
||||||
|
|
Loading…
Reference in New Issue