From 3e2ff463bce58bd0603f3bb3859ad01227e3f141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 26 Apr 2024 13:47:25 +0200 Subject: [PATCH] make the script which subscribe to user calendars on ms-graph more tolerant to errors The script does not fails and exit when some calendar settings are not reachable --- .changes/unreleased/Feature-20240426-134831.yaml | 6 ++++++ .../Command/MapAndSubscribeUserCalendarCommand.php | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changes/unreleased/Feature-20240426-134831.yaml diff --git a/.changes/unreleased/Feature-20240426-134831.yaml b/.changes/unreleased/Feature-20240426-134831.yaml new file mode 100644 index 000000000..00952fe57 --- /dev/null +++ b/.changes/unreleased/Feature-20240426-134831.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Make the script which subscribe to microsoft calendars changes more tolerant + to errors or missing configuration on the microsoft side +time: 2024-04-26T13:48:31.476415017+02:00 +custom: + Issue: "197" diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php index 4964f0064..177fd2375 100644 --- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php +++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php @@ -49,8 +49,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command $limit = 50; $offset = 0; - /** @var \DateInterval $interval the interval before the end of the expiration */ - $interval = new \DateInterval('P1D'); $expiration = (new \DateTimeImmutable('now'))->add(new \DateInterval($input->getOption('subscription-duration'))); $users = $this->userRepository->findAllAsArray('fr'); $created = 0; @@ -93,7 +91,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command } catch (UserAbsenceSyncException $e) { $this->logger->error('could not sync user absence', ['userId' => $user->getId(), 'email' => $user->getEmail(), 'exception' => $e->getTraceAsString(), 'message' => $e->getMessage()]); $output->writeln(sprintf('Could not sync user absence: id: %s and email: %s', $user->getId(), $user->getEmail())); - throw $e; } // we first try to renew an existing subscription, if any.