From 1ad799fac8340302b6c2cfdc97a845d647aa948d Mon Sep 17 00:00:00 2001 From: pratikshad Date: Fri, 30 Jan 2015 17:54:25 +1000 Subject: [PATCH] Fixed issue of deadlock CRM-15470 ---------------------------------------- * CRM-15470: MySQL transaction deadlocks with multiple simultaneous recurring contribution updates https://issues.civicrm.org/jira/browse/CRM-15470 --- CRM/Activity/BAO/Activity.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index e156a526b9..74603d8570 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -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(); + } } /** -- 2.25.1