Skip to content

Commit 68b5188

Browse files
authored
Merge pull request #10 from litencatt/configurable-timeout
Configurable Guzzle client timeout
2 parents 0253bb6 + d483058 commit 68b5188

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $notifier = new Faultline\Notifier([
1616
'project' => 'faultline-php',
1717
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
1818
'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
19+
'timeout' => '30.0',
1920
'notifications' => [
2021
[
2122
'type'=> 'slack',

src/Notifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function postNotice($url, $notice)
6969
'x-api-key' => $this->opt['apiKey']
7070
],
7171
'json' => $notice,
72-
'timeout' => 5.0,
72+
'timeout' => (isset($this->opt['timeout']) ? $this->opt['timeout'] : 5.0),
7373
];
7474
if (preg_match('/^5/', \GuzzleHttp\Client::VERSION)) {
7575
$config['exceptions'] = false;

tests/NotifierTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function testNotify()
1717
'project' => 'faultline-test',
1818
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
1919
'endpoint' => 'https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/v0',
20+
'timeout' => '30.0',
2021
'notifications' => [
2122
[
2223
'type'=> 'slack',
@@ -49,6 +50,7 @@ public function testNotifyErrorShouldBeBoolean()
4950
'project' => 'faultline-test',
5051
'apiKey' => 'xxxxXXXXXxXxXXxxXXXXXXXxxxxXXXXXX',
5152
'endpoint' => 'https://example.com/v0',
53+
'timeout' => '30.0',
5254
'notifications' => [
5355
[
5456
'type'=> 'slack',

0 commit comments

Comments
 (0)