public function CronService::log in Acquia Connector 3.x
Same name and namespace in other branches
- 8.2 src/CronService.php \Drupal\acquia_connector\CronService::log()
- 8 src/CronService.php \Drupal\acquia_connector\CronService::log()
Overrides RfcLoggerTrait::log
File
- src/
CronService.php, line 19
Class
- CronService
- Runs Connector related tasks during Cron.
Namespace
Drupal\acquia_connectorCode
public function log($level, $message, array $context = []) {
// Make sure that even when cron failures prevent hook_cron() from being
// called, we still send out a heartbeat.
if (!empty($context['channel']) && $context['channel'] == 'cron' && $message == 'Attempting to re-run cron while it is already running.') {
// Avoid doing this too frequently.
$last_update_attempt = \Drupal::state()
->get('acquia_subscription_data.timestamp', FALSE);
if (!$last_update_attempt || \Drupal::time()
->getRequestTime() - $last_update_attempt >= 60 * 60) {
$subscription = new Subscription();
$subscription
->update();
}
}
}