Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
WangNingkai committed Dec 6, 2018
1 parent 688e32a commit 71ba5bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/Helpers/GraphRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ public function request(
@list($endpoint, $requestBody, $requestHeaders, $timeout) = $param;
$this->requestBody = $requestBody ?? '';
$this->headers = $requestHeaders ?? [];
$this->timeout = $timeout ?? 5;
$this->timeout = $timeout ?? 120;
$this->endpoint = $endpoint;
} else {
$this->endpoint = $param;
$this->headers = [];
$this->timeout = 5;
$this->timeout = 120;
}
if (!$token) {
$this->headers = array_merge([
Expand Down Expand Up @@ -126,9 +126,10 @@ public function request(
$curl = new Curl();
}
$curl->setHeaders($this->headers);
$curl->setConnectTimeout(3);
$curl->setConnectTimeout(5);
$curl->setTimeout((int)$this->timeout);
$curl->setUrl($this->endpoint);
$curl->setRetry(3);
$curl->setOpts($options);
$curl->exec();
$curl->close();
Expand Down
1 change: 1 addition & 0 deletions app/Helpers/Tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ public static function getFileContent($url, $cache = true)
$curl = new Curl();
$curl->setConnectTimeout(5);
$curl->setTimeout(120);
$curl->setRetry(3);
$curl->setOpts([
CURLOPT_AUTOREFERER => true,
CURLOPT_FAILONERROR => true,
Expand Down

0 comments on commit 71ba5bc

Please sign in to comment.