#805 (again): proper fix to avoid blocking when creating a ticket with DBInsert() (instead of DBInsertNoReload !!)

SVN:trunk[3032]
This commit is contained in:
Denis Flaven
2013-12-10 11:07:24 +00:00
parent 1afcf46970
commit ebff827013

View File

@@ -169,10 +169,19 @@
<type>Overload-DBObject</type> <type>Overload-DBObject</type>
<code><![CDATA[ protected function DBInsertTracked_Internal($bDoNotReload = false) <code><![CDATA[ protected function DBInsertTracked_Internal($bDoNotReload = false)
{ {
$oMutex = new iTopMutex('ticket_insert'); // Beware !!!
$oMutex->Lock(); // Compensate the fact that CMDBObject::DBInsertTracked_Internal does NOT call the derived version of DBInsertNoReload
// when performing an INsert with "no reload" but actually calls it (followed by Reload) when doing an Insert with reload !!
if ($bDoNotReload)
{
$oMutex = new iTopMutex('ticket_insert');
$oMutex->Lock();
}
$ret = parent::DBInsertTracked_Internal($bDoNotReload); $ret = parent::DBInsertTracked_Internal($bDoNotReload);
$oMutex->Unlock(); if ($bDoNotReload)
{
$oMutex->Unlock();
}
return $ret; return $ret;
} }
]]></code> ]]></code>