Skip to content

Commit a5d1306

Browse files
Jędrzej Józefowiczeli-darkly
authored andcommitted
Add option to set timeout different than default 5 seconds for Redis feature requester (#113)
1 parent c60bc3a commit a5d1306

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/LaunchDarkly/LDDFeatureRequester.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public function __construct($baseUri, $sdkKey, $options)
2626
if (!isset($options['redis_port'])) {
2727
$options['redis_port'] = 6379;
2828
}
29+
if (!isset($options['redis_timeout'])) {
30+
$options['redis_timeout'] = 5;
31+
}
2932

3033
$this->_options = $options;
3134

@@ -50,12 +53,14 @@ protected function get_connection()
5053
if ($this->_connection instanceof ClientInterface) {
5154
return $this->_connection;
5255
}
53-
56+
5457
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
5558
return $this->_connection = new \Predis\Client(array(
56-
"scheme" => "tcp",
57-
"host" => $this->_options['redis_host'],
58-
"port" => $this->_options['redis_port']));
59+
"scheme" => "tcp",
60+
"timeout" => $this->_options['redis_timeout'],
61+
"host" => $this->_options['redis_host'],
62+
"port" => $this->_options['redis_port']
63+
));
5964
}
6065

6166
/**

0 commit comments

Comments
 (0)