dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add CollationFa"
[lhc/web/wiklou.git]
/
includes
/
jobqueue
/
aggregator
/
JobQueueAggregatorRedis.php
diff --git
a/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
b/includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
index
81f93c0
..
6ae8837
100644
(file)
--- a/
includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
+++ b/
includes/jobqueue/aggregator/JobQueueAggregatorRedis.php
@@
-20,6
+20,7
@@
* @file
* @author Aaron Schulz
*/
* @file
* @author Aaron Schulz
*/
+use Psr\Log\LoggerInterface;
/**
* Class to handle tracking information about all queues using PhpRedis
/**
* Class to handle tracking information about all queues using PhpRedis
@@
-33,6
+34,8
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
/** @var RedisConnectionPool */
protected $redisPool;
class JobQueueAggregatorRedis extends JobQueueAggregator {
/** @var RedisConnectionPool */
protected $redisPool;
+ /** @var LoggerInterface */
+ protected $logger;
/** @var array List of Redis server addresses */
protected $servers;
/** @var array List of Redis server addresses */
protected $servers;
@@
-49,9
+52,10
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
parent::__construct( $params );
$this->servers = isset( $params['redisServers'] )
? $params['redisServers']
parent::__construct( $params );
$this->servers = isset( $params['redisServers'] )
? $params['redisServers']
- :
array( $params['redisServer'] )
; // b/c
+ :
[ $params['redisServer'] ]
; // b/c
$params['redisConfig']['serializer'] = 'none';
$this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
$params['redisConfig']['serializer'] = 'none';
$this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
+ $this->logger = \MediaWiki\Logger\LoggerFactory::getInstance( 'redis' );
}
protected function doNotifyQueueEmpty( $wiki, $type ) {
}
protected function doNotifyQueueEmpty( $wiki, $type ) {
@@
-65,14
+69,14
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
protected function doGetAllReadyWikiQueues() {
$conn = $this->getConnection();
if ( !$conn ) {
protected function doGetAllReadyWikiQueues() {
$conn = $this->getConnection();
if ( !$conn ) {
- return
array()
;
+ return
[]
;
}
try {
$map = $conn->hGetAll( $this->getReadyQueueKey() );
if ( is_array( $map ) && isset( $map['_epoch'] ) ) {
unset( $map['_epoch'] ); // ignore
}
try {
$map = $conn->hGetAll( $this->getReadyQueueKey() );
if ( is_array( $map ) && isset( $map['_epoch'] ) ) {
unset( $map['_epoch'] ); // ignore
- $pendingDBs =
array()
; // (type => list of wikis)
+ $pendingDBs =
[]
; // (type => list of wikis)
foreach ( $map as $key => $time ) {
list( $type, $wiki ) = $this->decodeQueueName( $key );
$pendingDBs[$type][] = $wiki;
foreach ( $map as $key => $time ) {
list( $type, $wiki ) = $this->decodeQueueName( $key );
$pendingDBs[$type][] = $wiki;
@@
-87,7
+91,7
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
} catch ( RedisException $e ) {
$this->redisPool->handleError( $conn, $e );
} catch ( RedisException $e ) {
$this->redisPool->handleError( $conn, $e );
- return
array()
;
+ return
[]
;
}
}
}
}
@@
-104,7
+108,7
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
protected function getConnection() {
$conn = false;
foreach ( $this->servers as $server ) {
protected function getConnection() {
$conn = false;
foreach ( $this->servers as $server ) {
- $conn = $this->redisPool->getConnection( $server );
+ $conn = $this->redisPool->getConnection( $server
, $this->logger
);
if ( $conn ) {
break;
}
if ( $conn ) {
break;
}
@@
-127,6
+131,6
@@
class JobQueueAggregatorRedis extends JobQueueAggregator {
private function decodeQueueName( $name ) {
list( $type, $wiki ) = explode( '/', $name, 2 );
private function decodeQueueName( $name ) {
list( $type, $wiki ) = explode( '/', $name, 2 );
- return
array( rawurldecode( $type ), rawurldecode( $wiki ) )
;
+ return
[ rawurldecode( $type ), rawurldecode( $wiki ) ]
;
}
}
}
}