X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/5ec45cd7fa8b353f4f211c0abfcc0c875a938c7e..4a4b3aa7ac2582e9131176d9361f30502e8a80b7:/Command/CalendarCommand.php diff --git a/Command/CalendarCommand.php b/Command/CalendarCommand.php index f722aae..9a7edb3 100644 --- a/Command/CalendarCommand.php +++ b/Command/CalendarCommand.php @@ -136,6 +136,7 @@ class CalendarCommand extends Command { //With expired token if ($this->google->isAccessTokenExpired()) { //Refresh token + //TODO: better handle internal_failure if (($gRefresh = $this->google->getRefreshToken()) && ($gToken = $this->google->fetchAccessTokenWithRefreshToken($gRefresh)) && empty($gToken['error'])) { //Get google token $googleToken = $this->doctrine->getRepository(GoogleToken::class)->findOneById($token['id']); @@ -157,6 +158,7 @@ class CalendarCommand extends Command { //Refresh failed } else { //Show error + //TODO: remove that and simply log internal failure ? fprintf(STDERR, 'Unable to refresh token %d: %s', $token['id'], $gToken['error']?:''); //TODO: warn user by mail ? @@ -309,6 +311,9 @@ class CalendarCommand extends Command { throw new \LogicException(sprintf('Calendar %s event %s operation failed', $calendar, $this->prefix.$session['id']), 0, $e); } } + + //Sleep + usleep(300000); } //Get all sessions