X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;ds=sidebyside;f=includes%2Fpoolcounter%2FPoolCounterRedis.php;h=5a15ddf6bb8dc38e236e3410dc48638f98e1f8e4;hb=dfaa26a7b19ab65190a76cd32259a3637cc3e2fd;hp=f2c59d2da1e8959f769687acee486b16f63d608b;hpb=4b73a8b6fbb6da651af850a7d667e6e8d59e6fce;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/poolcounter/PoolCounterRedis.php b/includes/poolcounter/PoolCounterRedis.php index f2c59d2da1..5a15ddf6bb 100644 --- a/includes/poolcounter/PoolCounterRedis.php +++ b/includes/poolcounter/PoolCounterRedis.php @@ -18,6 +18,7 @@ * @file * @author Aaron Schulz */ +use Psr\Log\LoggerInterface; /** * Version of PoolCounter that uses Redis @@ -55,6 +56,8 @@ class PoolCounterRedis extends PoolCounter { protected $ring; /** @var RedisConnectionPool */ protected $pool; + /** @var LoggerInterface */ + protected $logger; /** @var array (server label => host) map */ protected $serversByLabel; /** @var string SHA-1 of the key */ @@ -87,6 +90,7 @@ class PoolCounterRedis extends PoolCounter { $conf['redisConfig']['serializer'] = 'none'; // for use with Lua $this->pool = RedisConnectionPool::singleton( $conf['redisConfig'] ); + $this->logger = \MediaWiki\Logger\LoggerFactory::getInstance( 'redis' ); $this->keySha1 = sha1( $this->key ); $met = ini_get( 'max_execution_time' ); // usually 0 in CLI mode @@ -107,7 +111,7 @@ class PoolCounterRedis extends PoolCounter { $servers = $this->ring->getLocations( $this->key, 3 ); ArrayUtils::consistentHashSort( $servers, $this->key ); foreach ( $servers as $server ) { - $conn = $this->pool->getConnection( $this->serversByLabel[$server] ); + $conn = $this->pool->getConnection( $this->serversByLabel[$server], $this->logger ); if ( $conn ) { break; } @@ -151,6 +155,7 @@ class PoolCounterRedis extends PoolCounter { // @codingStandardsIgnoreStart Generic.Files.LineLength static $script = + /** @lang Lua */ <<getWakeupListKey(), $this->getSlotListKey() ] // Just wait for an actual pool slot : [ $this->getSlotListKey() ]; @@ -287,12 +292,13 @@ LUA; */ protected function initAndPopPoolSlotList( RedisConnRef $conn, $now ) { static $script = + /** @lang Lua */ <<