Improved the processing of background task to enable more advanced functionalities like queuing (protection against reentrance) -reintegrated from trunk

SVN:2.0.3[3314]
This commit is contained in:
Romain Quetiez
2014-09-03 09:56:44 +00:00
parent 4841738f01
commit 9dd4b05866

View File

@@ -120,10 +120,17 @@ abstract class AsyncTask extends DBObject
{ {
try try
{ {
$this->Set('status', 'running'); if ($this->Get('status') == 'running')
$this->Set('started', time()); {
$this->DBUpdate(); return self::ALREADY_RUNNING;
return self::OK; }
else
{
$this->Set('status', 'running');
$this->Set('started', time());
$this->DBUpdate();
return self::OK;
}
} }
catch(Exception $e) catch(Exception $e)
{ {