diff --git a/automatic_updates.module b/automatic_updates.module index f37a9d2c6a5187a580ced20d79e85a3ef4e2763f..2b020f3af540af196ac0dbdc2002faa0648f3ac3 100644 --- a/automatic_updates.module +++ b/automatic_updates.module @@ -74,7 +74,7 @@ function automatic_updates_page_top(array &$page_top) { function automatic_updates_cron() { $state = \Drupal::state(); $request_time = \Drupal::time()->getRequestTime(); - $last_check = $state->get('automatic_updates.last_check', 0); + $last_check = $state->get('automatic_updates.cron_last_check', 0); // Only allow cron to run once every hour. if (($request_time - $last_check) < 3600) { return; @@ -115,7 +115,7 @@ function automatic_updates_cron() { foreach ($checker->getCategories() as $category) { $checker->run($category); } - $state->set('automatic_updates.last_check', \Drupal::time()->getCurrentTime()); + $state->set('automatic_updates.cron_last_check', \Drupal::time()->getCurrentTime()); } /** diff --git a/src/Services/InPlaceUpdate.php b/src/Services/InPlaceUpdate.php index 1194a24d642f08bb4b6a0224c76eb9eda4b09211..fdd6f6fbb922d5507d5d90e4fb63078f30c92ef7 100644 --- a/src/Services/InPlaceUpdate.php +++ b/src/Services/InPlaceUpdate.php @@ -252,12 +252,15 @@ class InPlaceUpdate implements UpdateInterface { $this->httpClient->get($url, [ 'sink' => $destination, 'delay' => $delay, + // Some of the core quasi-patch zip files are large, increase timeout. + 'timeout' => 120, ]); } catch (RequestException $exception) { $response = $exception->getResponse(); - if (!$response || ($retry = $response->getHeader('Retry-After'))) { - $this->doGetResource($url, $destination, !empty($retry[0]) ? $retry[0] : 10 * 1000); + if ($response && $response->getStatusCode() === 429) { + $delay = 1000 * (isset($response->getHeader('Retry-After')[0]) ? $response->getHeader('Retry-After')[0] : 10); + $this->doGetResource($url, $destination, $delay); } else { $this->logger->error('Retrieval of "@url" failed with: @message', [ diff --git a/src/Services/Notify.php b/src/Services/Notify.php index 41b84a50b3ec18027a64d1ee79a518a0198c4416..f5dcbe553dbc75f26ec1cb00985e4b4194b08032 100644 --- a/src/Services/Notify.php +++ b/src/Services/Notify.php @@ -120,9 +120,9 @@ class Notify implements NotifyInterface { $notify_list = $this->configFactory->get('update.settings')->get('notification.emails'); if (!empty($notify_list)) { $frequency = $this->configFactory->get('automatic_updates.settings')->get('check_frequency'); - $last_check = $this->state->get('automatic_updates.last_check') ?: 0; + $last_check = $this->state->get('automatic_updates.notify_last_check') ?: 0; if (($this->time->getRequestTime() - $last_check) > $frequency) { - $this->state->set('automatic_updates.last_check', $this->time->getRequestTime()); + $this->state->set('automatic_updates.notify_last_check', $this->time->getRequestTime()); $params['subject'] = new PluralTranslatableMarkup( count($messages),