X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FHashRing.php;h=21558f77b60c8e91e90055b0c829b718768adf53;hb=f4ec592330517bc80e2ee351d0385e752f16e3fb;hp=be40965e8414a651880f58ffe37ae75fdc3d4dbe;hpb=971a50c4f3c61fb3a4bec60cd712317bb8ddcb9a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/HashRing.php b/includes/libs/HashRing.php index be40965e84..21558f77b6 100644 --- a/includes/libs/HashRing.php +++ b/includes/libs/HashRing.php @@ -26,14 +26,14 @@ * @since 1.22 */ class HashRing { - /** @var Array (location => weight) */ + /** @var array (location => weight) */ protected $sourceMap = []; - /** @var Array (location => (start, end)) */ + /** @var array (location => (start, end)) */ protected $ring = []; /** @var HashRing|null */ protected $liveRing; - /** @var Array (location => UNIX timestamp) */ + /** @var array (location => UNIX timestamp) */ protected $ejectionExpiries = []; /** @var int UNIX timestamp */ protected $ejectionNextExpiry = INF; @@ -116,11 +116,12 @@ class HashRing { // If more locations are requested, wrap-around and keep adding them reset( $this->ring ); while ( count( $locations ) < $limit ) { - list( $location, ) = each( $this->ring ); + $location = key( $this->ring ); if ( $location === $primaryLocation ) { break; // don't go in circles } $locations[] = $location; + next( $this->ring ); } return $locations;