Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 61dff22

Browse files
committed
Retry downloads
1 parent 1b84734 commit 61dff22

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/php/libsdk/SDK/FileOps.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ protected function mv(string $src, string $dst) : bool
116116
protected function download(string $url, string $dest_fn = NULL) : ?string
117117
{/*{{{*/
118118
$fd = NULL;
119+
$retry = 0;
120+
121+
retry:
119122
$ch = curl_init();
120123

121124
curl_setopt($ch, CURLOPT_URL, $url);
@@ -143,6 +146,9 @@ protected function download(string $url, string $dest_fn = NULL) : ?string
143146
if ($dest_fn) {
144147
fclose($fd);
145148
}
149+
if ($retry++ < 3) {
150+
goto retry;
151+
}
146152
throw new Exception($err);
147153
}
148154

0 commit comments

Comments
 (0)