X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueue.php;h=69a3defbc118e591ab4780c0cfcc15e028673d0b;hb=08db2b721e95395842bb4972ab89a5bd7ec09c7e;hp=73ca3a8eaa9915f3d0bac391649d672cf9ca8c56;hpb=1632780c2d4b804120fd06ddb4d8c9928c0dd7fb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php index 73ca3a8eaa..69a3defbc1 100644 --- a/includes/jobqueue/JobQueue.php +++ b/includes/jobqueue/JobQueue.php @@ -94,7 +94,7 @@ abstract class JobQueue { * This might be useful for improving concurrency for job acquisition. * - claimTTL : If supported, the queue will recycle jobs that have been popped * but not acknowledged as completed after this many seconds. Recycling - * of jobs simple means re-inserting them into the queue. Jobs can be + * of jobs simply means re-inserting them into the queue. Jobs can be * attempted up to three times before being discarded. * * Queue classes should throw an exception if they do not support the options given. @@ -323,6 +323,12 @@ abstract class JobQueue { $this->doBatchPush( $jobs, $flags ); $this->aggr->notifyQueueNonEmpty( $this->wiki, $this->type ); + + foreach ( $jobs as $job ) { + if ( $job->isRootJob() ) { + $this->deduplicateRootJob( $job ); + } + } } /** @@ -359,7 +365,7 @@ abstract class JobQueue { // Flag this job as an old duplicate based on its "root" job... try { if ( $job && $this->isRootJobOldDuplicate( $job ) ) { - JobQueue::incrStats( 'job-pop-duplicate', $this->type ); + JobQueue::incrStats( 'dupe_pops', $this->type ); $job = DuplicateJob::newFromJob( $job ); // convert to a no-op } } catch ( Exception $e ) { @@ -425,11 +431,11 @@ abstract class JobQueue { * * This does nothing for certain queue classes. * - * @param Job $job + * @param IJobSpecification $job * @throws MWException * @return bool */ - final public function deduplicateRootJob( Job $job ) { + final public function deduplicateRootJob( IJobSpecification $job ) { if ( $job->getType() !== $this->type ) { throw new MWException( "Got '{$job->getType()}' job; expected '{$this->type}'." ); } @@ -440,11 +446,11 @@ abstract class JobQueue { /** * @see JobQueue::deduplicateRootJob() - * @param Job $job + * @param IJobSpecification $job * @throws MWException * @return bool */ - protected function doDeduplicateRootJob( Job $job ) { + protected function doDeduplicateRootJob( IJobSpecification $job ) { if ( !$job->hasRootJobParams() ) { throw new MWException( "Cannot register root job; missing parameters." ); } @@ -631,7 +637,6 @@ abstract class JobQueue { * @since 1.22 */ final public function getSiblingQueuesWithJobs( array $types ) { - return $this->doGetSiblingQueuesWithJobs( $types ); } @@ -655,7 +660,6 @@ abstract class JobQueue { * @since 1.22 */ final public function getSiblingQueueSizes( array $types ) { - return $this->doGetSiblingQueueSizes( $types ); } @@ -677,8 +681,12 @@ abstract class JobQueue { * @since 1.22 */ public static function incrStats( $key, $type, $delta = 1 ) { - wfIncrStats( $key, $delta ); - wfIncrStats( "{$key}-{$type}", $delta ); + static $stats; + if ( !$stats ) { + $stats = RequestContext::getMain()->getStats(); + } + $stats->updateCount( "jobqueue.{$key}.all", $delta ); + $stats->updateCount( "jobqueue.{$key}.{$type}", $delta ); } /**