From 52e1eeecf8ae083eb04889d5dcdf4c713e138e39 Mon Sep 17 00:00:00 2001 From: Sascha Grossenbacher Date: Thu, 29 Aug 2019 21:29:45 +0200 Subject: [PATCH] Retry failed downloads once --- src/Patches.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Patches.php b/src/Patches.php index d51fac15..31f5225c 100644 --- a/src/Patches.php +++ b/src/Patches.php @@ -369,7 +369,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); + } } // The order here is intentional. p1 is most likely to apply with git apply.