* LinksUpdate is now an EnqueueableDataUpdate
and can yeild a prioritzed refreshLinks job.
* DeferredUpdates::runUpdates() now takes an enqueue
flag to try to use jobs. This is set in restInPeace().
Updates that change many links will be less likely to
increase lag, as the runners are more strict about that.
* Also made the LinksDeletionUpdate job enqueue happen
post-send on page deletion for consistency
Bug: T95501
Change-Id: I8863caef9c8f03234699d33e4d47d2310a0c8446
Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
- DeferredUpdates::doUpdates( 'commit' );
+ DeferredUpdates::doUpdates( 'commit', 'enqueue' );
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
* Do any deferred updates and clear the list
*
* @param string $commit Set to 'commit' to commit after every update to
* Do any deferred updates and clear the list
*
* @param string $commit Set to 'commit' to commit after every update to
+ * @param string $mode Use "enqueue" to use the job queue when possible [Default: run]
* prevent lock contention
*/
* prevent lock contention
*/
- public static function doUpdates( $commit = '' ) {
+ public static function doUpdates( $commit = '', $mode = 'run' ) {
$updates = self::$updates;
while ( count( $updates ) ) {
$updates = self::$updates;
while ( count( $updates ) ) {
}
// Delegate DataUpdate execution to the DataUpdate class
}
// Delegate DataUpdate execution to the DataUpdate class
- DataUpdate::runUpdates( $dataUpdates, 'run' );
+ DataUpdate::runUpdates( $dataUpdates, $mode );
// Execute the non-DataUpdate tasks
foreach ( $otherUpdates as $update ) {
try {
$update->doUpdate();
// Execute the non-DataUpdate tasks
foreach ( $otherUpdates as $update ) {
try {
$update->doUpdate();
if ( $commit === 'commit' ) {
wfGetLBFactory()->commitMasterChanges();
}
if ( $commit === 'commit' ) {
wfGetLBFactory()->commitMasterChanges();
}
*
* @todo document (e.g. one-sentence top-level class description).
*/
*
* @todo document (e.g. one-sentence top-level class description).
*/
-class LinksUpdate extends SqlDataUpdate {
+class LinksUpdate extends SqlDataUpdate implements EnqueueableDataUpdate {
// @todo make members protected, but make sure extensions don't break
/** @var int Page ID of the article linked from */
// @todo make members protected, but make sure extensions don't break
/** @var int Page ID of the article linked from */
+
+ public function getAsJobSpecification() {
+ return array(
+ 'wiki' => $this->mDb->getWikiID(),
+ 'job' => new JobSpecification(
+ 'refreshLinks',
+ array( 'prioritize' => true ),
+ array( 'removeDuplicates' => true ),
+ $this->getTitle()
+ )
+ );
+ }
// Delete pagelinks, update secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
// Delete pagelinks, update secondary indexes, etc
$updates = $this->getDeletionUpdates( $content );
- // Make sure an enqueued jobs run after commit so they see the deletion
- wfGetDB( DB_MASTER )->onTransactionIdle( function() use ( $updates ) {
- DataUpdate::runUpdates( $updates, 'enqueue' );
- } );
+ foreach ( $updates as $update ) {
+ DeferredUpdates::addUpdate( $update );
+ }
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );
// Reparse any pages transcluding this page
LinksUpdate::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );