PoolCounterRedis.php (mediawiki-1.31.1) | : | PoolCounterRedis.php (mediawiki-1.32.0) | ||
---|---|---|---|---|
skipping to change at line 88 | skipping to change at line 88 | |||
const AWAKE_ONE = 1; // wake-up if when a slot can be taken from an exist ing process | const AWAKE_ONE = 1; // wake-up if when a slot can be taken from an exist ing process | |||
const AWAKE_ALL = 2; // wake-up if an existing process finishes and wake up such others | const AWAKE_ALL = 2; // wake-up if an existing process finishes and wake up such others | |||
/** @var PoolCounterRedis[] List of active PoolCounterRedis objects in th is script */ | /** @var PoolCounterRedis[] List of active PoolCounterRedis objects in th is script */ | |||
protected static $active = null; | protected static $active = null; | |||
function __construct( $conf, $type, $key ) { | function __construct( $conf, $type, $key ) { | |||
parent::__construct( $conf, $type, $key ); | parent::__construct( $conf, $type, $key ); | |||
$this->serversByLabel = $conf['servers']; | $this->serversByLabel = $conf['servers']; | |||
$this->ring = new HashRing( array_fill_keys( array_keys( $conf['s | ||||
ervers'] ), 100 ) ); | $serverLabels = array_keys( $conf['servers'] ); | |||
$this->ring = new HashRing( array_fill_keys( $serverLabels, 10 ) | ||||
); | ||||
$conf['redisConfig']['serializer'] = 'none'; // for use with Lua | $conf['redisConfig']['serializer'] = 'none'; // for use with Lua | |||
$this->pool = RedisConnectionPool::singleton( $conf['redisConfig' ] ); | $this->pool = RedisConnectionPool::singleton( $conf['redisConfig' ] ); | |||
$this->logger = \MediaWiki\Logger\LoggerFactory::getInstance( 're dis' ); | $this->logger = \MediaWiki\Logger\LoggerFactory::getInstance( 're dis' ); | |||
$this->keySha1 = sha1( $this->key ); | $this->keySha1 = sha1( $this->key ); | |||
$met = ini_get( 'max_execution_time' ); // usually 0 in CLI mode | $met = ini_get( 'max_execution_time' ); // usually 0 in CLI mode | |||
$this->lockTTL = $met ? 2 * $met : 3600; | $this->lockTTL = $met ? 2 * $met : 3600; | |||
if ( self::$active === null ) { | if ( self::$active === null ) { | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |