first few changes to memcached client:
authorDomas Mituzas <midom@users.mediawiki.org>
Tue, 27 Oct 2009 06:57:51 +0000 (06:57 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Tue, 27 Oct 2009 06:57:51 +0000 (06:57 +0000)
* reduce connect attempts from 3 to 2
* remove the backoff logic, which just doesn't make sense in datacenter environments

includes/memcached-client.php

index 7974530..eb5478e 100644 (file)
@@ -262,7 +262,7 @@ class memcached
       $this->_timeout_microseconds = 0;
 
       $this->_connect_timeout = 0.01;
-      $this->_connect_attempts = 3;
+      $this->_connect_attempts = 2;
    }
 
    // }}}
@@ -704,15 +704,6 @@ class memcached
       $timeout = $this->_connect_timeout;
       $errno = $errstr = null;
       for ($i = 0; !$sock && $i < $this->_connect_attempts; $i++) {
-         if ($i > 0) {
-            # Sleep until the timeout, in case it failed fast
-            $elapsed = microtime(true) - $t;
-            if ( $elapsed < $timeout ) {
-               usleep(($timeout - $elapsed) * 1e6);
-            }
-            $timeout *= 2;
-         }
-         $t = microtime(true);
          if ($this->_persistant == 1)
          {
             $sock = @pfsockopen($ip, $port, $errno, $errstr, $timeout);