diff --git a/src/memcached_backend.cpp b/src/memcached_backend.cpp index 7ee1b26..755a4ac 100644 --- a/src/memcached_backend.cpp +++ b/src/memcached_backend.cpp @@ -58,7 +58,11 @@ MemcachedBackend::MemcachedBackend(MemcachedConfigReader* config_reader, // timeout because libmemcached tries to connect to all servers sequentially // during start-up, and if any are not up we don't want to wait for any // significant length of time. - _options = "--CONNECT-TIMEOUT=10 --SUPPORT-CAS --POLL-TIMEOUT=250 --BINARY-PROTOCOL"; + // Note that the poll timeout needs to be at most half the timeout used by + // the MemcachedStore (i.e. Sprout / Homestead when sending requests to us) + // to give us time to try a second replica if the request to the first replica + // times out. + _options = "--CONNECT-TIMEOUT=10 --SUPPORT-CAS --POLL-TIMEOUT=50 --BINARY-PROTOCOL"; // Create an updater to keep the store configured appropriately. _updater = new Updater(this, std::mem_fun(&MemcachedBackend::update_config));