/** @var string Key to prefix the queue keys with (used for testing) */
protected $key;
- /**
- * @var null|int maximum seconds between execution of periodic tasks. Used to speed up
- * testing but should otherwise be left unset.
- */
- protected $maximumPeriodicTaskSeconds;
-
/**
* @params include:
* - redisConfig : An array of parameters to RedisConnectionPool::__construct().
* If a hostname is specified but no port, the standard port number
* 6379 will be used. Required.
* - compression : The type of compression to use; one of (none,gzip).
- * - maximumPeriodicTaskSeconds : Maximum seconds between check periodic tasks. Set to
- * force faster execution of periodic tasks for inegration tests that
- * rely on checkDelay. Without this the integration tests are very very
- * slow. This really shouldn't be set in production.
* @param array $params
*/
public function __construct( array $params ) {
$this->server = $params['redisServer'];
$this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
$this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
- $this->maximumPeriodicTaskSeconds = isset( $params['maximumPeriodicTaskSeconds'] ) ?
- $params['maximumPeriodicTaskSeconds'] : null;
}
protected function supportedOrders() {
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
- * @return bool
+ * @param int $flags
+ * @return void
* @throws JobQueueError
*/
protected function doBatchPush( array $jobs, $flags ) {
}
if ( !count( $items ) ) {
- return true; // nothing to do
+ return; // nothing to do
}
$conn = $this->getConnection();
if ( $failed > 0 ) {
wfDebugLog( 'JobQueueRedis', "Could not insert {$failed} {$this->type} job(s)." );
- return false;
+ throw new RedisException( "Could not insert {$failed} {$this->type} job(s)." );
}
- JobQueue::incrStats( 'job-insert', $this->type, count( $items ) );
+ JobQueue::incrStats( 'job-insert', $this->type, count( $items ), $this->wiki );
JobQueue::incrStats( 'job-insert-duplicate', $this->type,
- count( $items ) - $failed - $pushed );
+ count( $items ) - $failed - $pushed, $this->wiki );
} catch ( RedisException $e ) {
$this->throwRedisException( $conn, $e );
}
-
- return true;
}
/**
break; // no jobs; nothing to do
}
- JobQueue::incrStats( 'job-pop', $this->type );
+ JobQueue::incrStats( 'job-pop', $this->type, 1, $this->wiki );
$item = $this->unserialize( $blob );
if ( $item === false ) {
wfDebugLog( 'JobQueueRedis', "Could not unserialize {$this->type} job." );
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndDeleteBlob( RedisConnRef $conn ) {
/**
* @param RedisConnRef $conn
- * @return array serialized string or false
+ * @return array Serialized string or false
* @throws RedisException
*/
protected function popAndAcquireBlob( RedisConnRef $conn ) {
/**
* This function should not be called outside JobQueueRedis
*
- * @param $uid string
- * @param $conn RedisConnRef
+ * @param string $uid
+ * @param RedisConnRef $conn
* @return Job|bool Returns false if the job does not exist
* @throws MWException|JobQueueError
*/
if ( $res ) {
list( $released, $abandoned, $pruned, $undelayed ) = $res;
$count += $released + $pruned + $undelayed;
- JobQueue::incrStats( 'job-recycle', $this->type, $released );
- JobQueue::incrStats( 'job-abandon', $this->type, $abandoned );
+ JobQueue::incrStats( 'job-recycle', $this->type, $released, $this->wiki );
+ JobQueue::incrStats( 'job-abandon', $this->type, $abandoned, $this->wiki );
}
} catch ( RedisException $e ) {
$this->throwRedisException( $conn, $e );
}
$period = min( $periods );
$period = max( $period, 30 ); // sanity
- // Support override for faster testing
- if ( $this->maximumPeriodicTaskSeconds !== null ) {
- $period = min( $period, $this->maximumPeriodicTaskSeconds );
- }
+
return array(
'recyclePruneAndUndelayJobs' => array(
'callback' => array( $this, 'recyclePruneAndUndelayJobs' ),
}
/**
- * @param $fields array
+ * @param array $fields
* @return Job|bool
*/
protected function getJobFromFields( array $fields ) {
}
/**
- * @param $conn RedisConnRef
- * @param $e RedisException
+ * @param RedisConnRef $conn
+ * @param RedisException $e
* @throws JobQueueError
*/
protected function throwRedisException( RedisConnRef $conn, $e ) {
}
/**
- * @param $prop string
- * @param $type string|null
+ * @param string $prop
+ * @param string|null $type
* @return string
*/
private function getQueueKey( $prop, $type = null ) {
}
/**
- * @param $key string
+ * @param string $key
* @return void
*/
public function setTestingPrefix( $key ) {