setTimeSensitivity(self::TIME_SENSITIVE); $this->setAllowParallelRuns(false); $this->setInterval(3600); } protected function run($argument): void { if (!$this->calendarFederationConfig->isFederationEnabled()) { return; } $downloadedEvents = 0; $oneHourAgo = $this->time->getTime() - 3600; $calendars = $this->federatedCalendarMapper->findUnsyncedSinceBefore($oneHourAgo); foreach ($calendars as $calendar) { try { $downloadedEvents += $this->syncService->syncOne($calendar); } catch (ClientExceptionInterface $e) { $name = $calendar->getUri(); $this->logger->error("Failed to sync federated calendar $name: " . $e->getMessage(), [ 'exception' => $e, 'calendar' => $calendar->toCalendarInfo(), ]); } // Prevent stalling the background job queue for too long if ($downloadedEvents >= self::DOWNLOAD_LIMIT) { break; } } } }