Set visiblity of some HashRing methods
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 18 Mar 2018 04:22:56 +0000 (21:22 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 18 Mar 2018 06:49:03 +0000 (23:49 -0700)
* getLiveRing() is now protected
* getLocation() is now final

Change-Id: I16002fe7187d8bbb6e36d4dd9a1302ee1d46a4bb

includes/jobqueue/JobQueueFederated.php
includes/libs/HashRing.php

index 118b0f9..7f3b2b1 100644 (file)
@@ -187,7 +187,7 @@ class JobQueueFederated extends JobQueue {
                // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
                for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
                        try {
-                               $partitionRing->getLiveRing();
+                               $partitionRing->getLiveLocationWeights();
                        } catch ( UnexpectedValueException $e ) {
                                break; // all servers down; nothing to insert to
                        }
index 21558f7..6612130 100644 (file)
@@ -83,7 +83,7 @@ class HashRing {
         * @param string $item
         * @return string Location
         */
-       public function getLocation( $item ) {
+       final public function getLocation( $item ) {
                $locations = $this->getLocations( $item, 1 );
 
                return $locations[0];
@@ -174,7 +174,7 @@ class HashRing {
         * @return HashRing
         * @throws UnexpectedValueException
         */
-       public function getLiveRing() {
+       protected function getLiveRing() {
                $now = time();
                if ( $this->liveRing === null || $this->ejectionNextExpiry <= $now ) {
                        $this->ejectionExpiries = array_filter(