MediaWiki REL1_32
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
47 foreach ( $update->jobsByDomain as $domain => $jobs ) {
48 $this->jobsByDomain[$domain] = $this->jobsByDomain[$domain] ?? [];
49 $this->jobsByDomain[$domain] = array_merge( $this->jobsByDomain[$domain], $jobs );
50 }
51 }
52
53 public function doUpdate() {
54 foreach ( $this->jobsByDomain as $domain => $jobs ) {
55 $group = JobQueueGroup::singleton( $domain );
56 try {
57 $group->push( $jobs );
58 } catch ( Exception $e ) {
59 // Get in as many jobs as possible and let other post-send updates happen
60 MWExceptionHandler::logException( $e );
61 }
62 }
63 }
64}
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)
returning false will NOT prevent logging $e
Definition hooks.txt:2226
Interface that deferrable updates should implement.
Interface that deferrable updates can implement.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))