array( 'result' => 'Poll',
'stage' => 'queued', 'status' => Status::newGood() )
);
- $ok = JobQueueGroup::singleton()->push( new AssembleUploadChunksJob(
+ JobQueueGroup::singleton()->push( new AssembleUploadChunksJob(
Title::makeTitle( NS_FILE, $filekey ),
array(
'filename' => $this->mParams['filename'],
'session' => $this->getContext()->exportSession()
)
) );
- if ( $ok ) {
- $result['result'] = 'Poll';
- } else {
- UploadBase::setSessionStatus( $filekey, false );
- $this->dieUsage(
- "Failed to start AssembleUploadChunks.php", 'stashfailed' );
- }
+ $result['result'] = 'Poll';
} else {
$status = $this->mUpload->concatenateChunks();
if ( !$status->isGood() ) {
$this->mParams['filekey'],
array( 'result' => 'Poll', 'stage' => 'queued', 'status' => Status::newGood() )
);
- $ok = JobQueueGroup::singleton()->push( new PublishStashedFileJob(
+ JobQueueGroup::singleton()->push( new PublishStashedFileJob(
Title::makeTitle( NS_FILE, $this->mParams['filename'] ),
array(
'filename' => $this->mParams['filename'],
'session' => $this->getContext()->exportSession()
)
) );
- if ( $ok ) {
- $result['result'] = 'Poll';
- } else {
- UploadBase::setSessionStatus( $this->mParams['filekey'], false );
- $this->dieUsage(
- "Failed to start PublishStashedFile.php", 'publishfailed' );
- }
+ $result['result'] = 'Poll';
} else {
/** @var $status Status */
$status = $this->mUpload->performUpload( $this->mParams['comment'],
* @deprecated since 1.21
*/
public static function batchInsert( $jobs ) {
- return JobQueueGroup::singleton()->push( $jobs );
+ JobQueueGroup::singleton()->push( $jobs );
+ return true;
}
/**
* @deprecated since 1.21
*/
public static function safeBatchInsert( $jobs ) {
- return JobQueueGroup::singleton()->push( $jobs, JobQueue::QOS_ATOMIC );
+ JobQueueGroup::singleton()->push( $jobs, JobQueue::QOS_ATOMIC );
+ return true;
}
/**
* @deprecated since 1.21
*/
public function insert() {
- return JobQueueGroup::singleton()->push( $this );
+ JobQueueGroup::singleton()->push( $this );
+ return true;
}
/**
*/
final public function batchPush( array $jobs, $flags = 0 ) {
if ( !count( $jobs ) ) {
- return true; // nothing to do
+ return; // nothing to do
}
foreach ( $jobs as $job ) {
/**
* @see JobQueue::batchPush()
* @param array $jobs
- * @param array $flags
+ * @param int $flags
*/
abstract protected function doBatchPush( array $jobs, $flags );
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param array $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
$this->cache->set( $this->getCacheKey( 'empty' ), 'false', JobQueueDB::CACHE_TTL_LONG );
- return true;
+ return;
}
/**
throw new JobQueueError(
"Could not insert job(s), {$this->maxPartitionsTry} partitions tried." );
}
-
- return true;
}
/**
*
* @param Job|array $jobs A single Job or a list of Jobs
* @throws MWException
- * @return bool
- * @todo Return value here is not useful
+ * @return void
*/
public function push( $jobs ) {
$jobs = is_array( $jobs ) ? $jobs : array( $jobs );
if ( !count( $jobs ) ) {
- return true;
+ return;
}
$jobsByType = array(); // (job type => list of jobs)
$this->cache->clear( 'queues-ready' );
}
}
-
- return true;
}
/**
/**
* @see JobQueue::doBatchPush()
* @param array $jobs
- * @param array $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 ), $this->wiki );
JobQueue::incrStats( 'job-insert-duplicate', $this->type,
} catch ( RedisException $e ) {
$this->throwRedisException( $conn, $e );
}
-
- return true;
}
/**