From db8e13d749f88b6b97b4d605ed3ddd28a4e5c622 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sat, 9 Nov 2019 17:46:22 +0300 Subject: [PATCH] Hotfix to handle Chrly's long responses --- common/models/Textures.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/models/Textures.php b/common/models/Textures.php index 2077cfc..9051a6c 100644 --- a/common/models/Textures.php +++ b/common/models/Textures.php @@ -65,12 +65,22 @@ class Textures { public function getTextures(): array { /** @var SkinSystemApi $api */ $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 { $textures = $api->textures($this->account->username); } catch (RequestException $e) { Yii::warning('Cannot get textures from skinsystem.ely.by. Exception message is ' . $e->getMessage()); } catch (GuzzleException $e) { - Yii::error($e); + Yii::warning($e); } return $textures ?? [];