Fixed issue of deadlock CRM-15470
authorpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 30 Jan 2015 07:54:25 +0000 (17:54 +1000)
committerpratikshad <pratiksha.dubey@webaccess.co.in>
Fri, 30 Jan 2015 07:54:25 +0000 (17:54 +1000)
----------------------------------------
* CRM-15470: MySQL transaction deadlocks with multiple simultaneous recurring contribution updates
  https://issues.civicrm.org/jira/browse/CRM-15470

CRM/Activity/BAO/Activity.php

index e156a526b9e82bdf5b0b72b19e53092b6321f510..74603d8570ede6f7dc5cfc027c95d52804a9b461 100644 (file)
@@ -270,7 +270,13 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
     if ($recordTypeID) {
       $activityContact->record_type_id = $recordTypeID;
     }
-    $activityContact->delete();
+
+    //let's check if activity contact record exits and then delete.
+    //looks like delete leads to deadlock when multiple simultaneous
+    //requests are done. CRM-15470
+    if ($activityContact->find()) {
+      $activityContact->delete();
+    }
   }
 
   /**