mirror of
https://github.com/elyby/accounts.git
synced 2024-11-30 02:32:26 +05:30
Hotfix to handle Chrly's long responses
This commit is contained in:
parent
0dc8ca8c78
commit
db8e13d749
@ -65,12 +65,22 @@ class Textures {
|
|||||||
public function getTextures(): array {
|
public function getTextures(): array {
|
||||||
/** @var SkinSystemApi $api */
|
/** @var SkinSystemApi $api */
|
||||||
$api = Yii::$container->get(SkinSystemApi::class);
|
$api = Yii::$container->get(SkinSystemApi::class);
|
||||||
|
if (YII_ENV_PROD) {
|
||||||
|
$api->setClient(new \GuzzleHttp\Client([
|
||||||
|
'connect_timeout' => 2,
|
||||||
|
'decode_content' => false,
|
||||||
|
'read_timeout' => 5,
|
||||||
|
'stream' => true,
|
||||||
|
'timeout' => 5,
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$textures = $api->textures($this->account->username);
|
$textures = $api->textures($this->account->username);
|
||||||
} catch (RequestException $e) {
|
} catch (RequestException $e) {
|
||||||
Yii::warning('Cannot get textures from skinsystem.ely.by. Exception message is ' . $e->getMessage());
|
Yii::warning('Cannot get textures from skinsystem.ely.by. Exception message is ' . $e->getMessage());
|
||||||
} catch (GuzzleException $e) {
|
} catch (GuzzleException $e) {
|
||||||
Yii::error($e);
|
Yii::warning($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $textures ?? [];
|
return $textures ?? [];
|
||||||
|
Loading…
Reference in New Issue
Block a user