From 79b37e0ace73980ba6c9eb584acbf5862b718aba Mon Sep 17 00:00:00 2001 From: Ross Riley Date: Fri, 23 Feb 2018 15:02:58 +0000 Subject: [PATCH] Default the failure limit to 1, as a non-zero integer is required The default of zero throws an invalid argument error despite the Memcached docs indicating that this should be a valid value. libmemcached requires `MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT` to be a non-zero integer: - https://bazaar.launchpad.net/~tangent-trunk/libmemcached/1.0/view/head:/libmemcached/behavior.cc?start_revid=1194#L114 The globals initialization function default to `1` - https://github.com/php-memcached-dev/php-memcached/blob/v3.0.4/php_memcached.c#L4081) --- src/Handler/Factory/MemcachedFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Handler/Factory/MemcachedFactory.php b/src/Handler/Factory/MemcachedFactory.php index a28608d..df7f607 100644 --- a/src/Handler/Factory/MemcachedFactory.php +++ b/src/Handler/Factory/MemcachedFactory.php @@ -102,7 +102,7 @@ protected function configure(Memcached $memcached, array $connections, OptionsBa $memcached->setOptions([ Memcached::OPT_BINARY_PROTOCOL => $binary, Memcached::OPT_LIBKETAMA_COMPATIBLE => $options->getBoolean('consistent_hash'), - Memcached::OPT_SERVER_FAILURE_LIMIT => $options->getInt('server_failure_limit'), + Memcached::OPT_SERVER_FAILURE_LIMIT => $options->getInt('server_failure_limit', 1), // See #3 Memcached::OPT_NUMBER_OF_REPLICAS => $options->getInt('number_of_replicas'), Memcached::OPT_RANDOMIZE_REPLICA_READ => $options->getBoolean('randomize_replica_read'), Memcached::OPT_REMOVE_FAILED_SERVERS => $options->getBoolean('remove_failed_servers'),