Skip to content

Commit

Permalink
Merge pull request #10 from litencatt/configurable-timeout
Browse files Browse the repository at this point in the history
Configurable Guzzle client timeout
  • Loading branch information
k1LoW authored Jul 31, 2018
2 parents 0253bb6 + d483058 commit 68b5188
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ $notifier = new Faultline\Notifier([
'project' => 'faultline-php',
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
'timeout' => '30.0',
'notifications' => [
[
'type'=> 'slack',
Expand Down
2 changes: 1 addition & 1 deletion src/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function postNotice($url, $notice)
'x-api-key' => $this->opt['apiKey']
],
'json' => $notice,
'timeout' => 5.0,
'timeout' => (isset($this->opt['timeout']) ? $this->opt['timeout'] : 5.0),
];
if (preg_match('/^5/', \GuzzleHttp\Client::VERSION)) {
$config['exceptions'] = false;
Expand Down
2 changes: 2 additions & 0 deletions tests/NotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function testNotify()
'project' => 'faultline-test',
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
'timeout' => '30.0',
'notifications' => [
[
'type'=> 'slack',
Expand Down Expand Up @@ -49,6 +50,7 @@ public function testNotifyErrorShouldBeBoolean()
'project' => 'faultline-test',
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
'endpoint' => 'https://example.com/v0',
'timeout' => '30.0',
'notifications' => [
[
'type'=> 'slack',
Expand Down

0 comments on commit 68b5188

Please sign in to comment.