* @file
* @author Aaron Schulz
*/
+use Psr\Log\LoggerInterface;
/**
* Version of PoolCounter that uses Redis
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 */
$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
$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;
}
// @codingStandardsIgnoreStart Generic.Files.LineLength
static $script =
+ /** @lang Lua */
<<<LUA
local kSlots,kSlotsNextRelease,kWakeup,kWaiting = unpack(KEYS)
local rMaxWorkers,rExpiry,rSlot,rSlotTime,rAwakeAll,rTime = unpack(ARGV)
*/
protected function initAndPopPoolSlotList( RedisConnRef $conn, $now ) {
static $script =
+ /** @lang Lua */
<<<LUA
local kSlots,kSlotsNextRelease,kSlotWaits = unpack(KEYS)
local rMaxWorkers,rMaxQueue,rTimeout,rExpiry,rSess,rTime = unpack(ARGV)
*/
protected function registerAcquisitionTime( RedisConnRef $conn, $slot, $now ) {
static $script =
+ /** @lang Lua */
<<<LUA
local kSlots,kSlotsNextRelease,kSlotWaits = unpack(KEYS)
local rSlot,rExpiry,rSess,rTime = unpack(ARGV)