GroupContactCache: Drop temp table after releasing lock
authorMatthew Wire <mjw@mjwconsult.co.uk>
Sat, 30 Oct 2021 16:32:51 +0000 (17:32 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Sat, 30 Oct 2021 16:33:03 +0000 (17:33 +0100)
CRM/Contact/BAO/GroupContactCache.php

index 0fb98d5dbc9cd1e183ebc4707058b324b20aa88e..a393da2d45137d98887d683b4e8531a92d2cdf53 100644 (file)
@@ -361,6 +361,7 @@ WHERE  id IN ( $groupIDs )
       self::clearGroupContactCache([$groupID]);
       self::updateCacheFromTempTable($groupContactsTempTable, [$groupID]);
       self::releaseGroupLocks([$groupID]);
+      $groupContactsTempTable->drop();
     }
   }
 
@@ -705,6 +706,7 @@ ORDER BY   gc.contact_id, g.children
         self::clearGroupContactCache($lockedGroups);
         self::updateCacheFromTempTable($groupContactsTempTable, $lockedGroups);
         self::releaseGroupLocks($lockedGroups);
+        $groupContactsTempTable->drop();
       }
 
       $smartGroups = implode(',', $smartGroups);
@@ -769,7 +771,6 @@ ORDER BY   gc.contact_id, g.children
       "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);
     }