diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/poolcounter | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/poolcounter')
-rw-r--r-- | includes/poolcounter/PoolCounter.php | 9 | ||||
-rw-r--r-- | includes/poolcounter/PoolCounterRedis.php | 7 | ||||
-rw-r--r-- | includes/poolcounter/PoolWorkArticleView.php | 8 |
3 files changed, 13 insertions, 11 deletions
diff --git a/includes/poolcounter/PoolCounter.php b/includes/poolcounter/PoolCounter.php index 5692d731..1ec14aa1 100644 --- a/includes/poolcounter/PoolCounter.php +++ b/includes/poolcounter/PoolCounter.php @@ -192,10 +192,11 @@ abstract class PoolCounter { } /** - * Given a key (any string) and the number of lots, returns a slot number (an integer from the [0..($slots-1)] range). - * This is used for a global limit on the number of instances of a given type that can acquire a lock. - * The hashing is deterministic so that PoolCounter::$workers is always an upper limit of how many instances with - * the same key can acquire a lock. + * Given a key (any string) and the number of lots, returns a slot number (an integer from + * the [0..($slots-1)] range). This is used for a global limit on the number of instances of + * a given type that can acquire a lock. The hashing is deterministic so that + * PoolCounter::$workers is always an upper limit of how many instances with the same key + * can acquire a lock. * * @param string $key PoolCounter instance key (any string) * @param int $slots The number of slots (max allowed value is 65536) diff --git a/includes/poolcounter/PoolCounterRedis.php b/includes/poolcounter/PoolCounterRedis.php index 98797a30..d7357cfe 100644 --- a/includes/poolcounter/PoolCounterRedis.php +++ b/includes/poolcounter/PoolCounterRedis.php @@ -76,7 +76,7 @@ class PoolCounterRedis extends PoolCounter { const AWAKE_ONE = 1; // wake-up if when a slot can be taken from an existing process const AWAKE_ALL = 2; // wake-up if an existing process finishes and wake up such others - /** @var array List of active PoolCounterRedis objects in this script */ + /** @var PoolCounterRedis[] List of active PoolCounterRedis objects in this script */ protected static $active = null; function __construct( $conf, $type, $key ) { @@ -121,7 +121,6 @@ class PoolCounterRedis extends PoolCounter { } function acquireForMe() { - $status = $this->precheckAcquire(); if ( !$status->isGood() ) { return $status; @@ -131,7 +130,6 @@ class PoolCounterRedis extends PoolCounter { } function acquireForAnyone() { - $status = $this->precheckAcquire(); if ( !$status->isGood() ) { return $status; @@ -141,7 +139,6 @@ class PoolCounterRedis extends PoolCounter { } function release() { - if ( $this->slot === null ) { return Status::newGood( PoolCounter::NOT_LOCKED ); // not locked } @@ -190,7 +187,7 @@ class PoolCounterRedis extends PoolCounter { return 1 LUA; try { - $res = $conn->luaEval( $script, + $conn->luaEval( $script, array( $this->getSlotListKey(), $this->getSlotRTimeSetKey(), diff --git a/includes/poolcounter/PoolWorkArticleView.php b/includes/poolcounter/PoolWorkArticleView.php index a702d2e8..d601467d 100644 --- a/includes/poolcounter/PoolWorkArticleView.php +++ b/includes/poolcounter/PoolWorkArticleView.php @@ -142,8 +142,12 @@ class PoolWorkArticleView extends PoolCounterWork { // Timing hack if ( $time > 3 ) { - wfDebugLog( 'slow-parse', sprintf( "%-5.2f %s", $time, - $this->page->getTitle()->getPrefixedDBkey() ) ); + // TODO: Use Parser's logger (once it has one) + $logger = MediaWiki\Logger\LoggerFactory::getInstance( 'slow-parse' ); + $logger->info( '{time} {title}', array( + 'time' => number_format( $time, 2 ), + 'title' => $this->page->getTitle()->getPrefixedDBkey(), + ) ); } if ( $this->cacheable && $this->parserOutput->isCacheable() && $isCurrent ) { |