MediaWiki REL1_34
JobQueueEnqueueUpdate.php
Go to the documentation of this file.
1<?php
23use Wikimedia\Assert\Assert;
24
34
39 public function __construct( $domain, array $jobs ) {
40 $this->jobsByDomain[$domain] = $jobs;
41 }
42
43 public function merge( MergeableUpdate $update ) {
45 Assert::parameterType( __CLASS__, $update, '$update' );
46 '@phan-var self $update';
47
48 foreach ( $update->jobsByDomain as $domain => $jobs ) {
49 $this->jobsByDomain[$domain] = $this->jobsByDomain[$domain] ?? [];
50 $this->jobsByDomain[$domain] = array_merge( $this->jobsByDomain[$domain], $jobs );
51 }
52 }
53
54 public function doUpdate() {
55 foreach ( $this->jobsByDomain as $domain => $jobs ) {
56 $group = JobQueueGroup::singleton( $domain );
57 try {
58 $group->push( $jobs );
59 } catch ( Exception $e ) {
60 // Get in as many jobs as possible and let other post-send updates happen
61 MWExceptionHandler::logException( $e );
62 }
63 }
64 }
65}
Enqueue lazy-pushed jobs that have accumulated from JobQueueGroup.
array[] $jobsByDomain
Map of (domain ID => IJobSpecification[])
doUpdate()
Perform the actual work.
merge(MergeableUpdate $update)
Merge this update with $update.
__construct( $domain, array $jobs)
Interface that deferrable updates should implement.
Interface that deferrable updates can implement to signal that updates can be combined.