1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 03:24:01 +02:00

feat: add retry logic to the http client (#2692)

* refactor: extract http client

* feat: add retry logic to http client
This commit is contained in:
Dag
2022-05-08 03:58:57 +02:00
committed by GitHub
parent 0c7a7f320f
commit 5d77d14f9d
3 changed files with 139 additions and 317 deletions

View File

@@ -610,8 +610,8 @@ EOD;
try {
$result = getContents($uri, $this->authHeaders, array(), true);
} catch (UnexpectedResponseException $e) {
switch ($e->getResponseCode()) {
} catch (HttpException $e) {
switch ($e->getCode()) {
case 401:
case 403:
if ($retries) {
@@ -621,8 +621,8 @@ EOD;
continue 2;
}
default:
$code = $e->getResponseCode();
$data = $e->getResponseBody();
$code = $e->getCode();
$data = $e->getMessage();
returnServerError(<<<EOD
Failed to make api call: $api
HTTP Status: $code