From aaaa048d6479e706e3bd1ace538cf8dc30abc858 Mon Sep 17 00:00:00 2001 From: denpamusic Date: Sun, 8 Dec 2019 04:35:53 +0300 Subject: [PATCH] Added ability to set timeout --- src/Client.php | 10 ++++++---- src/Config.php | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 74f52d6..2c4de2d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -72,10 +72,12 @@ public function __construct($config = []) // construct client $this->client = new GuzzleHttp([ - 'base_uri' => $this->config->getDsn(), - 'auth' => $this->config->getAuth(), - 'verify' => $this->config->getCa(), - 'handler' => $this->getHandler(), + 'base_uri' => $this->config->getDsn(), + 'auth' => $this->config->getAuth(), + 'verify' => $this->config->getCa(), + 'timeout' => (float) $this->config['timeout'], + 'connect_timeout' => (float) $this->config['timeout'], + 'handler' => $this->getHandler(), ]); } diff --git a/src/Config.php b/src/Config.php index 610af00..547a71e 100644 --- a/src/Config.php +++ b/src/Config.php @@ -23,6 +23,7 @@ class Config implements \ArrayAccess, \Countable 'user' => null, 'password' => null, 'ca' => null, + 'timeout' => false, 'preserve_case' => false, ];