fix: correctly clear after a request when an exception has been thrown
This commit is contained in:
parent
dda325bbbf
commit
1655ae3562
|
@ -766,25 +766,12 @@ void App::ProcessRequestThrow()
|
|||
|
||||
void App::ProcessRequest()
|
||||
{
|
||||
try
|
||||
{
|
||||
system.load_avg.StartRequest(cur.request);
|
||||
log << log2 << config.log_delimiter << logend;
|
||||
|
||||
try
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -798,13 +785,38 @@ void App::ProcessRequest()
|
|||
{
|
||||
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()
|
||||
{
|
||||
try
|
||||
{
|
||||
// simple operations which should not throw an exception
|
||||
cur.request->Clear();
|
||||
cur.session->ClearAfterRequest();
|
||||
|
@ -818,11 +830,6 @@ void App::ClearAfterRequest()
|
|||
model_connector.set_winix_session_logger(nullptr);
|
||||
|
||||
log << logendrequest;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
log << log1 << "App: an exception when clearing after a request" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue