$rowSet = []; // (sha1 => job) map for jobs that are de-duplicated
$rowList = []; // list of jobs for jobs that are not de-duplicated
foreach ( $jobs as $job ) {
- $row = $this->insertFields( $job );
+ $row = $this->insertFields( $job, $dbw );
if ( $job->ignoreDuplicates() ) {
$rowSet[$row['job_sha1']] = $row;
} else {
if ( $flags & self::QOS_ATOMIC ) {
$dbw->endAtomic( $method );
}
-
- return;
}
/**
/**
* @param IJobSpecification $job
+ * @param IDatabase $db
* @return array
*/
- protected function insertFields( IJobSpecification $job ) {
- $dbw = $this->getMasterDB();
-
+ protected function insertFields( IJobSpecification $job, IDatabase $db ) {
return [
// Fields that describe the nature of the job
'job_cmd' => $job->getType(),
'job_title' => $job->getTitle()->getDBkey(),
'job_params' => self::makeBlob( $job->getParams() ),
// Additional job metadata
- 'job_timestamp' => $dbw->timestamp(),
+ 'job_timestamp' => $db->timestamp(),
'job_sha1' => Wikimedia\base_convert(
sha1( serialize( $job->getDeduplicationInfo() ) ),
16, 36, 31