mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 10:04:54 +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:
parent
0c7a7f320f
commit
5d77d14f9d
3 changed files with 139 additions and 317 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue