mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
#953 Protect the background processing against corrupted (incomplete) objects.
SVN:2.0.2[3232]
This commit is contained in:
@@ -40,8 +40,24 @@ class ExecAsyncTask implements iBackgroundProcess
|
|||||||
$iProcessed = 0;
|
$iProcessed = 0;
|
||||||
while ((time() < $iTimeLimit) && ($oTask = $oSet->Fetch()))
|
while ((time() < $iTimeLimit) && ($oTask = $oSet->Fetch()))
|
||||||
{
|
{
|
||||||
$oTask->Set('started', time());
|
try
|
||||||
$oTask->DBUpdate();
|
{
|
||||||
|
$oTask->Set('started', time());
|
||||||
|
$oTask->DBUpdate();
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
// Corrupted task !! (for example: "Failed to reload object")
|
||||||
|
IssueLog::Error('Failed to process async task #'.$oTask->GetKey().' - reason: '.$e->getMessage().' - fatal error, deleting the task.');
|
||||||
|
if ($oTask->Get('event_id') != 0)
|
||||||
|
{
|
||||||
|
$oEventLog = MetaModel::GetObject('Event', $oTask->Get('event_id'));
|
||||||
|
$oEventLog->Set('message', 'Failed, corrupted data: '.$e->getMessage());
|
||||||
|
$oEventLog->DBUpdate();
|
||||||
|
}
|
||||||
|
$oTask->DBDelete();
|
||||||
|
continue; // end of processing for this task
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user