Cleanup Title::touchLinks() to use JobQueueGroup::lazyPush() in one batch
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 11 Sep 2019 21:56:24 +0000 (14:56 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 11 Sep 2019 21:56:24 +0000 (14:56 -0700)
Change-Id: I45f36a06cc333170f60162ee37b464865b6bdc37

includes/Title.php

index 81c6876..bdff7a7 100644 (file)
@@ -4270,12 +4270,21 @@ class Title implements LinkTarget, IDBAccessObject {
         * on the number of links. Typically called on create and delete.
         */
        public function touchLinks() {
-               DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this, 'pagelinks', 'page-touch' ) );
+               $jobs = [];
+               $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+                       $this,
+                       'pagelinks',
+                       [ 'causeAction' => 'page-touch' ]
+               );
                if ( $this->mNamespace == NS_CATEGORY ) {
-                       DeferredUpdates::addUpdate(
-                               new HTMLCacheUpdate( $this, 'categorylinks', 'category-touch' )
+                       $jobs[] = HTMLCacheUpdateJob::newForBacklinks(
+                               $this,
+                               'categorylinks',
+                               [ 'causeAction' => 'category-touch' ]
                        );
                }
+
+               JobQueueGroup::singleton()->lazyPush( $jobs );
        }
 
        /**