Generalize the LinkCache clear() call to JobRunner
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 14 Nov 2015 13:17:23 +0000 (05:17 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 14 Nov 2015 13:22:47 +0000 (05:22 -0800)
The use for this logic is not specific to RefreshLinksJob

Change-Id: I4bb911ab5882d1795e12163df8ae6b227c58bc8a

includes/jobqueue/JobRunner.php
includes/jobqueue/jobs/RefreshLinksJob.php

index 318330e..dd2ef8f 100644 (file)
@@ -191,7 +191,10 @@ class JobRunner implements LoggerAwareInterface {
                                }
                                // Commit all outstanding connections that are in a transaction
                                // to get a fresh repeatable read snapshot on every connection.
+                               // Note that jobs are still responsible for handling slave lag.
                                wfGetLBFactory()->commitAll();
+                               // Clear out title cache data from prior snapshots
+                               LinkCache::singleton()->clear();
                                $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 );
                                $timeMsTotal += $timeMs;
 
index 5f1a1a6..c42a4c6 100644 (file)
@@ -139,10 +139,6 @@ class RefreshLinksJob extends Job {
                        wfGetLB()->waitFor( $this->params['masterPos'] );
                }
 
-               // Clear out title cache data from prior job transaction snapshots
-               $linkCache = LinkCache::singleton();
-               $linkCache->clear();
-
                // Fetch the current page and revision...
                $page = WikiPage::factory( $title );
                $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );