X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueFederated.php;h=8b5a62ef54cfd663fe9830384073266820ee38c8;hb=6497541c9c089966ce7d3b0e0abd6b68192d30d8;hp=26886b75d59466ba7810dcd111e06f4ae7e0a268;hpb=d4780d84c0e67a6868cb10d4a9149d870ee2ae50;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueFederated.php b/includes/jobqueue/JobQueueFederated.php index 26886b75d5..8b5a62ef54 100644 --- a/includes/jobqueue/JobQueueFederated.php +++ b/includes/jobqueue/JobQueueFederated.php @@ -180,7 +180,6 @@ class JobQueueFederated extends JobQueue { // Try to insert the jobs and update $partitionsTry on any failures. // Retry to insert any remaning jobs again, ignoring the bad partitions. $jobsLeft = $jobs; - // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) { try { $partitionRing->getLiveLocationWeights(); @@ -200,7 +199,7 @@ class JobQueueFederated extends JobQueue { * @param HashRing &$partitionRing * @param int $flags * @throws JobQueueError - * @return array List of Job object that could not be inserted + * @return IJobSpecification[] List of Job object that could not be inserted */ protected function tryJobInsertions( array $jobs, HashRing &$partitionRing, $flags ) { $jobsLeft = []; @@ -288,7 +287,7 @@ class JobQueueFederated extends JobQueue { $job = false; } if ( $job ) { - $job->metadata['QueuePartition'] = $partition; + $job->setMetadata( 'QueuePartition', $partition ); return $job; } else { @@ -300,15 +299,16 @@ class JobQueueFederated extends JobQueue { return false; } - protected function doAck( Job $job ) { - if ( !isset( $job->metadata['QueuePartition'] ) ) { + protected function doAck( RunnableJob $job ) { + $partition = $job->getMetadata( 'QueuePartition' ); + if ( $partition === null ) { throw new MWException( "The given job has no defined partition name." ); } - $this->partitionQueues[$job->metadata['QueuePartition']]->ack( $job ); + $this->partitionQueues[$partition]->ack( $job ); } - protected function doIsRootJobOldDuplicate( Job $job ) { + protected function doIsRootJobOldDuplicate( IJobSpecification $job ) { $signature = $job->getRootJobParams()['rootJobSignature']; $partition = $this->partitionRing->getLiveLocation( $signature ); try {