/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param $flags
+ * @param int $flags
* @throws DBError|Exception
- * @return bool
+ * @return void
*/
protected function doBatchPush( array $jobs, $flags ) {
$dbw = $this->getMasterDB();
$that->doBatchPushInternal( $dbw, $jobs, $flags, $method );
}
);
-
- return true;
}
/**
* @param int $flags
* @param string $method
* @throws DBError
- * @return bool
+ * @return void
*/
public function doBatchPushInternal( IDatabase $dbw, array $jobs, $flags, $method ) {
if ( !count( $jobs ) ) {
- return true;
+ return;
}
$rowSet = array(); // (sha1 => job) map for jobs that are de-duplicated
foreach ( array_chunk( $rows, 50 ) as $rowBatch ) {
$dbw->insert( 'job', $rowBatch, $method );
}
- JobQueue::incrStats( 'job-insert', $this->type, count( $rows ) );
+ JobQueue::incrStats( 'job-insert', $this->type, count( $rows ), $this->wiki );
JobQueue::incrStats(
'job-insert-duplicate',
$this->type,
- count( $rowSet ) + count( $rowList ) - count( $rows )
+ count( $rowSet ) + count( $rowList ) - count( $rows ),
+ $this->wiki
);
} catch ( DBError $e ) {
if ( $flags & self::QOS_ATOMIC ) {
$this->cache->set( $this->getCacheKey( 'empty' ), 'false', JobQueueDB::CACHE_TTL_LONG );
- return true;
+ return;
}
/**
$this->cache->set( $this->getCacheKey( 'empty' ), 'true', self::CACHE_TTL_LONG );
break; // nothing to do
}
- JobQueue::incrStats( 'job-pop', $this->type );
+ JobQueue::incrStats( 'job-pop', $this->type, 1, $this->wiki );
// Get the job object from the row...
$title = Title::makeTitleSafe( $row->job_namespace, $row->job_title );
if ( !$title ) {
* Reserve a row with a single UPDATE without holding row locks over RTTs...
*
* @param string $uuid 32 char hex string
- * @param $rand integer Random unsigned integer (31 bits)
+ * @param int $rand Random unsigned integer (31 bits)
* @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
* @return stdClass|bool Row|false
*/
'job_id' => $ids ),
__METHOD__
);
- $count += $dbw->affectedRows();
- JobQueue::incrStats( 'job-recycle', $this->type, $dbw->affectedRows() );
+ $affected = $dbw->affectedRows();
+ $count += $affected;
+ JobQueue::incrStats( 'job-recycle', $this->type, $affected, $this->wiki );
$this->cache->set( $this->getCacheKey( 'empty' ), 'false', self::CACHE_TTL_LONG );
}
}
);
if ( count( $ids ) ) {
$dbw->delete( 'job', array( 'job_id' => $ids ), __METHOD__ );
- $count += $dbw->affectedRows();
- JobQueue::incrStats( 'job-abandon', $this->type, $dbw->affectedRows() );
+ $affected = $dbw->affectedRows();
+ $count += $affected;
+ JobQueue::incrStats( 'job-abandon', $this->type, $affected, $this->wiki );
}
$dbw->unlock( "jobqueue-recycle-{$this->type}", __METHOD__ );
}
/**
- * @param $index integer (DB_SLAVE/DB_MASTER)
+ * @param int $index (DB_SLAVE/DB_MASTER)
* @return DBConnRef
*/
protected function getDB( $index ) {
}
/**
- * @param $property
+ * @param string $property
* @return string
*/
private function getCacheKey( $property ) {
}
/**
- * @param $params
+ * @param array|bool $params
* @return string
*/
protected static function makeBlob( $params ) {
}
/**
- * @param $blob
+ * @param string $blob
* @return bool|mixed
*/
protected static function extractBlob( $blob ) {