Closed Versud closed 3 years ago
Мысль про кастомизацию HTTP клиента звучит вполне оправданно - это позволило бы расширить настройку guzzle, хотя острой необходимости в этом и нет, поэтому сам я это делать не буду. С радостью приму pull request, если кто-либо возьмется доработать это.
В вашей же проблеме увеличение параметра connect_timeout
не поможет, т.к. значение 0 по умолчанию задает неопределенное количество времени. Другими словами - пока запрос не закончит обработку. Если бы ошибка была связана с этим, то ее код был бы 28, а не 7. Вы видите эту ошибку по одной из следующих причин:
api.telegram.org
(Telegram не работает в некоторых странах)The thought of customizing the HTTP client sounds quite reasonable - it would allow expanding the guzzle setting, although there is no urgent need for this, so I will not do it myself. I would gladly accept a pull request if anyone can tweak this.
In your problem, increasing the connect_timeout
parameter will not help, because the default value of 0 specifies an indefinite amount of time. In other words - until the request finishes processing. If error was associated with this, then its code would be 28, not 7. You see this error for one of the following reasons:
api.telegram.org
(Telegram does not work in some countries)https://github.com/php-telegram-bot/telegram-bot-manager/issues/66 https://github.com/irazasyed/telegram-bot-sdk/issues/472
Спасибо за разъяснение. Моя недоработка в том, что не посмотрел поведение Guzzle при connection_timeout=0
В последнее время бот стал часто вылетать с исключением:
Полез в конструктор класса TeleBot для того, чтобы прокинуть конфиг для таймаута в
GuzzleHttp\Client
, но это нельзя сделать.Предлагаю либо ввести возможность установки своего экземпляра
GuzzleHttp\Client
, либо увеличить таймаут, т.к. 0 секунд по умолчанию - это мало.Recently, the bot began to crash frequently with an exception:
I got into the constructor of the TeleBot class in order to edit the config for the timeout in
GuzzleHttp\Client
, but this cannot be done by librarys config.I suggest either to introduce the ability to install your own instance of
GuzzleHttp\Client
, or to increase the timeout, because 0 seconds by default is not enough.