Skip to content

Commit

Permalink
feat(http-client): added timeout of 30 sec
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Mar 20, 2024
1 parent edfc777 commit 80c5d9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion phpmyfaq/src/phpMyFAQ/Administration/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Api
*/
public function __construct(private readonly Configuration $configuration)
{
$this->setHttpClient(HttpClient::create(['max_redirects' => 2]));
$this->setHttpClient(HttpClient::create(['max_redirects' => 2, 'timeout' => 30]));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function versions(): JsonResponse
$this->userIsAuthenticated();

try {
$versions = HttpClient::create()->request(
$versions = HttpClient::create(['timeout' => 30])->request(
'GET',
'https://api.phpmyfaq.de/versions'
);
Expand Down
4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/Setup/Upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function downloadPackage(string $version): string
{
$url = $this->getDownloadHost() . $this->getPath() . $this->getFilename($version);

$client = HttpClient::create();
$client = HttpClient::create(['timeout' => 30]);

try {
$response = $client->request('GET', $url);
Expand Down Expand Up @@ -170,7 +170,7 @@ public function downloadPackage(string $version): string
*/
public function verifyPackage(string $path, string $version): bool
{
$httpClient = HttpClient::create();
$httpClient = HttpClient::create(['timeout' => 30]);
$response = $httpClient->request(
'GET',
DownloadHostType::PHPMYFAQ->value . 'info/' . $version
Expand Down

0 comments on commit 80c5d9a

Please sign in to comment.