mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 07:42:17 +02:00
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:
@@ -119,12 +119,19 @@ abstract class AsyncTask extends DBObject
|
|||||||
public function MarkAsRunning()
|
public function MarkAsRunning()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if ($this->Get('status') == 'running')
|
||||||
|
{
|
||||||
|
return self::ALREADY_RUNNING;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$this->Set('status', 'running');
|
$this->Set('status', 'running');
|
||||||
$this->Set('started', time());
|
$this->Set('started', time());
|
||||||
$this->DBUpdate();
|
$this->DBUpdate();
|
||||||
return self::OK;
|
return self::OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
// Corrupted task !! (for example: "Failed to reload object")
|
// Corrupted task !! (for example: "Failed to reload object")
|
||||||
|
|||||||
Reference in New Issue
Block a user