From 2e1ad045138b7b4c381ba4254b5f5c92310d38b6 Mon Sep 17 00:00:00 2001 From: Jedrzej Jozefowicz Date: Fri, 9 Nov 2018 11:52:08 +0100 Subject: [PATCH] Add option to set timeout different than default 5 seconds for Redis feature requester --- src/LaunchDarkly/LDDFeatureRequester.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/LaunchDarkly/LDDFeatureRequester.php b/src/LaunchDarkly/LDDFeatureRequester.php index 1058f54ca..a0095686c 100644 --- a/src/LaunchDarkly/LDDFeatureRequester.php +++ b/src/LaunchDarkly/LDDFeatureRequester.php @@ -26,6 +26,9 @@ public function __construct($baseUri, $sdkKey, $options) if (!isset($options['redis_port'])) { $options['redis_port'] = 6379; } + if (!isset($options['redis_timeout'])) { + $options['redis_timeout'] = 5; + } $this->_options = $options; @@ -50,12 +53,14 @@ protected function get_connection() if ($this->_connection instanceof ClientInterface) { return $this->_connection; } - + /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */ return $this->_connection = new \Predis\Client(array( - "scheme" => "tcp", - "host" => $this->_options['redis_host'], - "port" => $this->_options['redis_port'])); + "scheme" => "tcp", + "timeout" => $this->_options['redis_timeout'], + "host" => $this->_options['redis_host'], + "port" => $this->_options['redis_port'] + )); } /**