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

@@ -119,12 +119,19 @@ abstract class AsyncTask extends DBObject
public function MarkAsRunning()
{
try
{
if ($this->Get('status') == 'running')
{
return self::ALREADY_RUNNING;
}
else
{
$this->Set('status', 'running');
$this->Set('started', time());
$this->DBUpdate();
return self::OK;
}
}
catch(Exception $e)
{
// Corrupted task !! (for example: "Failed to reload object")