mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
Trying to protect the Synchro for timeouts, since the synchro may be launched from the web (as a "web service", especially by the "collectors"). To be validated further with large amounts of data.
SVN:trunk[4210]
This commit is contained in:
@@ -491,11 +491,14 @@ try
|
||||
// Prepare insert columns
|
||||
$sInsertColumns = '`'.implode('`, `', $aInputColumns).'`';
|
||||
|
||||
$iPreviousTimeLimit = ini_get('max_execution_time');
|
||||
$iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
|
||||
$oMutex = new iTopMutex('synchro_import_'.$oDataSource->GetKey());
|
||||
$oMutex->Lock();
|
||||
foreach($aData as $iRow => $aRow)
|
||||
{
|
||||
$sReconciliationCondition = "`primary_key` = ".CMDBSource::Quote($aRow[$iPrimaryKeyCol]);
|
||||
set_time_limit($iLoopTimeLimit);
|
||||
$sReconciliationCondition = "`primary_key` = ".CMDBSource::Quote($aRow[$iPrimaryKeyCol]);
|
||||
$sSelect = "SELECT COUNT(*) FROM `$sTable` WHERE $sReconciliationCondition";
|
||||
$aRes = CMDBSource::QueryToArray($sSelect);
|
||||
$iCount = $aRes[0]['COUNT(*)'];
|
||||
@@ -632,6 +635,7 @@ try
|
||||
}
|
||||
}
|
||||
$oMutex->Unlock();
|
||||
set_time_limit($iPreviousTimeLimit);
|
||||
|
||||
if (($sOutput == "summary") || ($sOutput == 'details'))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user