Bladeren bron

Slightly changed the arguments order of HashRing::addNodeToRing.

Daniele Alessandri 15 jaren geleden
bovenliggende
commit
994258b4c2
1 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 3 3
      lib/Predis.php

+ 3 - 3
lib/Predis.php

@@ -1439,14 +1439,14 @@ class HashRing implements IRing {
         $nodesCount  = count($this->_nodes);
         foreach ($this->_nodes as $node) {
             $weightRatio = $node['weight'] / $totalWeight;
-            $this->addNodeToRing($this->_ring, $node, $nodesCount, $weightRatio, $this->_replicas);
+            $this->addNodeToRing($this->_ring, $node, $nodesCount, $this->_replicas, $weightRatio);
         }
         ksort($this->_ring, SORT_NUMERIC);
         $this->_ringKeys = array_keys($this->_ring);
         $this->_ringKeysCount = count($this->_ringKeys);
     }
 
-    protected function addNodeToRing(&$ring, $node, $totalNodes, $weightRatio, $replicas) {
+    protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightRatio) {
         $nodeObject = $node['object'];
         $nodeHash = (string) $nodeObject;
         $replicas = (int) round($weightRatio * $totalNodes * $replicas);
@@ -1501,7 +1501,7 @@ class KetamaPureRing extends HashRing {
         parent::__construct($this::DEFAULT_REPLICAS);
     }
 
-    protected function addNodeToRing(&$ring, $node, $totalNodes, $weightRatio, $replicas) {
+    protected function addNodeToRing(&$ring, $node, $totalNodes, $replicas, $weightRatio) {
         $nodeObject = $node['object'];
         $nodeHash = (string) $nodeObject;
         $replicas = (int) floor($weightRatio * $totalNodes * ($replicas / 4));