Skip to content

Commit

Permalink
Merge pull request #21942 from mattwire/gccachedrop
Browse files Browse the repository at this point in the history
GroupContactCache: Drop temp table *after* releasing lock
  • Loading branch information
eileenmcnaughton authored Nov 4, 2021
2 parents c158e60 + 1d8398f commit 49dca11
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CRM/Contact/BAO/GroupContactCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ public static function load($group, $force = FALSE) {
self::clearGroupContactCache([$groupID]);
self::updateCacheFromTempTable($groupContactsTempTable, [$groupID]);
self::releaseGroupLocks([$groupID]);
$groupContactsTempTable->drop();
}
}

Expand Down Expand Up @@ -705,6 +706,7 @@ public static function populateTemporaryTableWithContactsInGroups(array $groupID
self::clearGroupContactCache($lockedGroups);
self::updateCacheFromTempTable($groupContactsTempTable, $lockedGroups);
self::releaseGroupLocks($lockedGroups);
$groupContactsTempTable->drop();
}

$smartGroups = implode(',', $smartGroups);
Expand Down Expand Up @@ -769,7 +771,6 @@ private static function updateCacheFromTempTable(CRM_Utils_SQL_TempTable $groupC
"INSERT IGNORE INTO civicrm_group_contact_cache (contact_id, group_id)
SELECT DISTINCT contact_id, group_id FROM $tempTable
");
$groupContactsTempTable->drop();
foreach ($groupIDs as $groupID) {
self::updateCacheTime([$groupID], TRUE);
}
Expand Down

0 comments on commit 49dca11

Please sign in to comment.