remove a code to finish job requests when winix exits
Actually there was a bug and the code was not correctly waiting for the job requests.
This commit is contained in:
@@ -934,33 +934,12 @@ void App::Start()
|
||||
fcgi_request = &cur.request->fcgi_request;
|
||||
}
|
||||
|
||||
WaitForRequestsToFinish();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* wait for requests from the jobs
|
||||
*/
|
||||
void App::WaitForRequestsToFinish()
|
||||
{
|
||||
bool is_req_tab_empty = false;
|
||||
|
||||
{
|
||||
Winix::Lock lock(synchro);
|
||||
system.DeleteOldRequests();
|
||||
is_req_tab_empty = system.req_tab.empty();
|
||||
}
|
||||
|
||||
while( is_req_tab_empty )
|
||||
{
|
||||
log << log3 << "App: waiting for requests to finish..." << logend << logsave;
|
||||
sleep(1);
|
||||
|
||||
{
|
||||
Winix::Lock lock(synchro);
|
||||
is_req_tab_empty = system.req_tab.empty();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* we do not wait for some job requests to finish (if there are such requests)
|
||||
* the job loop will exit immediately when a synchro->is_stop_signal is defined
|
||||
* and there is no need to process such requests (the www server will return a 50x error
|
||||
* to the client)
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@@ -217,7 +217,6 @@ private:
|
||||
|
||||
bool DoDatabaseMigration();
|
||||
bool TryToMakeDatabaseMigration();
|
||||
void WaitForRequestsToFinish();
|
||||
|
||||
|
||||
// !! IMPROVE ME
|
||||
|
@@ -198,6 +198,7 @@ return true;
|
||||
second thread
|
||||
*/
|
||||
|
||||
|
||||
// second thread (objects locked)
|
||||
bool Job::SignalReceived()
|
||||
{
|
||||
@@ -430,7 +431,6 @@ void Job::RemoveOldRequest(Request * request)
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace Winix
|
||||
|
||||
|
||||
|
@@ -138,6 +138,7 @@ private:
|
||||
void DoRequestContinuationJob(JobTask & job_task, size_t priority);
|
||||
void DoWinixJob(pt::Space & job);
|
||||
void RemoveOldRequest(Request * request);
|
||||
void RemoveAllJobsRequests();
|
||||
PluginRes DoRequestJobs(JobTask & task, long job_id, size_t priority);
|
||||
|
||||
};
|
||||
|
@@ -1526,9 +1526,9 @@ void System::DeleteOldRequests(bool leave_one_object)
|
||||
while( i != req_tab.end() )
|
||||
{
|
||||
// leave at least one object (even if it is finished)
|
||||
if( i->run_state == Request::RunState::finished && (!leave_one_object || req_tab.size() > 1) )
|
||||
if( (i->run_state == Request::RunState::finished || i->run_state == Request::RunState::not_assigned) && (!leave_one_object || req_tab.size() > 1) )
|
||||
{
|
||||
log << log3 << "System: removing finished request " << cur->request << logend;
|
||||
log << log3 << "System: removing a finished or not assigned request " << cur->request << logend;
|
||||
std::list<Request>::iterator old_i = i;
|
||||
++i;
|
||||
req_tab.erase(old_i);
|
||||
|
Reference in New Issue
Block a user