Commit 995f0cfa authored by shajiaiming's avatar shajiaiming

fix

parent de0e105f
...@@ -15,7 +15,7 @@ class FpfHttpClient ...@@ -15,7 +15,7 @@ class FpfHttpClient
public function __construct($config = []) public function __construct($config = [])
{ {
if (defined('IS_SWOOLE_SERVICE') && IS_SWOOLE_SERVICE === true) { if (defined('IS_SWOOLE_SERVICE') && IS_SWOOLE_SERVICE === true) {
$this->http_client = new SwooleHttpClient(); $this->http_client = new SwooleHttpClient($config);
} else { } else {
$this->http_client = new CurlHttpClient($config); $this->http_client = new CurlHttpClient($config);
} }
......
...@@ -49,11 +49,11 @@ class SwooleHttpClient ...@@ -49,11 +49,11 @@ class SwooleHttpClient
const METHOD_POST = 'POST'; const METHOD_POST = 'POST';
const METHOD_GET = 'GET'; const METHOD_GET = 'GET';
public function __construct() public function __construct($config = [])
{ {
$config = \Yii::$app->fpf->loadConfig('http_options'); $http_option = \Yii::$app->fpf->loadConfig('http_options');
$this->connect_timeout_ms = $config['connect_timeout'] ?? 10; $this->connect_timeout_ms = isset($config['connect_timeout']) ? $config['connect_timeout'] : ($http_option['connect_timeout'] ?? 10);
$this->timeout_ms = $config['timeout_ms'] ?? 100; $this->timeout_ms = isset($config['timeout_ms']) ? $config['timeout_ms'] : ($http_option['timeout_ms'] ?? 100) ;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment