From 70528c867a9f30956b6dc012be0bec2aada6e911 Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Thu, 29 Aug 2019 17:26:51 +0200 Subject: [PATCH] Retry failed downloads once --- src/Plugin/Patches.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Plugin/Patches.php b/src/Plugin/Patches.php index 90589d19..40a43e07 100644 --- a/src/Plugin/Patches.php +++ b/src/Plugin/Patches.php @@ -382,7 +382,14 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, // Download file from remote filesystem to this location. $hostname = parse_url($patch_url, PHP_URL_HOST); - $downloader->copy($hostname, $patch_url, $filename, false); + + try { + $downloader->copy($hostname, $patch_url, $filename, false); + } catch (\Exception $e) { + // In case of an exception, retry once as the download might + // have failed due to intermittent network issues. + $downloader->copy($hostname, $patch_url, $filename, false); + } } // Modified from drush6:make.project.inc