Move to using CRM_Utils_Constant for CIVICRM_SLOW_SMART_GROUP_SECONDS
authorRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Fri, 1 Sep 2023 08:50:19 +0000 (09:50 +0100)
committerRich Lott / Artful Robot <code.commits@artfulrobot.uk>
Sat, 16 Sep 2023 07:26:23 +0000 (08:26 +0100)
CRM/Contact/BAO/GroupContactCache.php

index 47d0c0cbd65aac14f930a9954ce2f4899fa75830..29f3c27dd0a25cbf1054df9224dd5668dc433321 100644 (file)
@@ -173,11 +173,12 @@ AND (
       $now = date('YmdHis');
       if ($startTime) {
         $took = microtime(TRUE) - $startTime;
-        if (defined('CIVICRM_SLOW_SMART_GROUP_SECONDS') && $took > CIVICRM_SLOW_SMART_GROUP_SECONDS) {
+        $maxTime = CRM_Utils_Constant::value('CIVICRM_SLOW_SMART_GROUP_SECONDS');
+        if ($maxTime && $took > $maxTime) {
           Civi::log()->warning(
             "Updating smart group $groupID took over "
-            . CIVICRM_SLOW_SMART_GROUP_SECONDS
-            . "s (" . number_format($took, 3) . "s)"
+            . $maxTime
+            . "s defined by CIVICRM_SLOW_SMART_GROUP_SECONDS (took " . number_format($took, 3) . "s)"
           );
         }
       }