Commit 370a0e05 authored by tufengqi's avatar tufengqi

Merge branch 'TRADE-539' into 'master'

Resolve TRADE-539 Closes TRADE-539 See merge request !12
parents 495f90f1 5e94e4b3
......@@ -43,11 +43,11 @@ class CurlHttpClient
const METHOD_POST = 'POST';
const METHOD_GET = 'GET';
public function __construct()
public function __construct($config = [])
{
$config = \Yii::$app->fpf->loadConfig('http_options');
$this->connect_timeout_ms = $config['connect_timeout'] ?? 10;
$this->timeout_ms = $config['timeout_ms'] ?? 100;
$http_option = \Yii::$app->fpf->loadConfig('http_options');
$this->connect_timeout_ms = isset($config['connect_timeout']) ? $config['connect_timeout'] : ($http_option['connect_timeout'] ?? 10);
$this->timeout_ms = isset($config['timeout_ms']) ? $config['timeout_ms'] : ($http_option['timeout_ms'] ?? 100) ;
}
/**
......
......@@ -12,12 +12,12 @@ class FpfHttpClient
*/
private $http_client;
public function __construct()
public function __construct($config = [])
{
if (defined('IS_SWOOLE_SERVICE') && IS_SWOOLE_SERVICE === true) {
$this->http_client = new SwooleHttpClient();
$this->http_client = new SwooleHttpClient($config);
} else {
$this->http_client = new CurlHttpClient();
$this->http_client = new CurlHttpClient($config);
}
}
......
......@@ -49,11 +49,11 @@ class SwooleHttpClient
const METHOD_POST = 'POST';
const METHOD_GET = 'GET';
public function __construct()
public function __construct($config = [])
{
$config = \Yii::$app->fpf->loadConfig('http_options');
$this->connect_timeout_ms = $config['connect_timeout'] ?? 10;
$this->timeout_ms = $config['timeout_ms'] ?? 100;
$http_option = \Yii::$app->fpf->loadConfig('http_options');
$this->connect_timeout_ms = isset($config['connect_timeout']) ? $config['connect_timeout'] : ($http_option['connect_timeout'] ?? 10);
$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