Update at 3am not every 6 hours

This commit is contained in:
Rich Lott / Artful Robot 2024-03-10 00:03:40 +00:00
parent 1d28eb4820
commit d2a0670381

View file

@ -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();