From d2a06703814aaf50df8be353cfc2a0a957f38e8e Mon Sep 17 00:00:00 2001 From: Rich Lott / Artful Robot Date: Sun, 10 Mar 2024 00:03:40 +0000 Subject: [PATCH] Update at 3am not every 6 hours --- Civi/Api4/Action/ContactCategory/Sync.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Civi/Api4/Action/ContactCategory/Sync.php b/Civi/Api4/Action/ContactCategory/Sync.php index 77bcd01..8fdee0f 100644 --- a/Civi/Api4/Action/ContactCategory/Sync.php +++ b/Civi/Api4/Action/ContactCategory/Sync.php @@ -161,8 +161,9 @@ class Sync extends \Civi\Api4\Generic\AbstractAction { $summary['memory_use'] = @round($_ / pow(1024, ($i = floor(log($_, 1024)))), 2) . ' ' . ['b', 'kb', 'mb', 'gb', 'tb', 'pb'][$i]; $result->exchangeArray($summary); - // Limit to running every 6 hours. - $settings['updateAfter'] = time() + 60 * 60 * 6; + // Limit to running every 24 hours; we actually want it to be stable within one day. + // Schedule for 3am to avoid busy times and DST. + $settings['updateAfter'] = strtotime('tomorrow + 180 minutes'); Setting::set(FALSE) ->addValue('contact_categories', $settings) ->execute();