Browse Source

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3032 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 11 years ago
parent
commit
38eb2c960a
1 changed files with 12 additions and 3 deletions
  1. 12 3
      datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml

+ 12 - 3
datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml

@@ -169,10 +169,19 @@
           <type>Overload-DBObject</type>
           <code><![CDATA[    protected function DBInsertTracked_Internal($bDoNotReload = false)
     {
-      $oMutex = new iTopMutex('ticket_insert');
-      $oMutex->Lock();
+      // Beware !!!
+      // 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);
-      $oMutex->Unlock();
+      if ($bDoNotReload)
+      {
+          $oMutex->Unlock();
+      }
       return $ret;
     }
         ]]></code>