jenkins-bot has submitted this change and it was merged.

Change subject: Use deferred updates in place of $wgActivityUpdatesUseJobQueue
......................................................................


Use deferred updates in place of $wgActivityUpdatesUseJobQueue

* This is simpler and does not require custom queue loops

Bug: T91284
Change-Id: Icb8b6aaeb496a4ff3cd3a7e20cdbea0c7dabd677
---
M includes/DefaultSettings.php
M includes/WatchedItem.php
2 files changed, 13 insertions(+), 24 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 6050ba7..70ae468 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1624,15 +1624,6 @@
 $wgEnotifUseJobQ = false;
 
 /**
- * Use the job queue for user activity updates like updating "last visited"
- * fields for email notifications of page changes. This should only be enabled
- * if the jobs have a dedicated runner to avoid update lag.
- *
- * @since 1.26
- */
-$wgActivityUpdatesUseJobQueue = false;
-
-/**
  * Use real name instead of username in e-mail "from" field.
  */
 $wgEnotifUseRealName = false;
diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php
index 73b0b937..adee126 100644
--- a/includes/WatchedItem.php
+++ b/includes/WatchedItem.php
@@ -224,8 +224,6 @@
        public function resetNotificationTimestamp(
                $force = '', $oldid = 0, $mode = self::IMMEDIATE
        ) {
-               global $wgActivityUpdatesUseJobQueue;
-
                // Only loggedin user can have a watchlist
                if ( wfReadOnly() || $this->mUser->isAnon() || 
!$this->isAllowed( 'editmywatchlist' ) ) {
                        return;
@@ -275,20 +273,20 @@
                }
 
                // If the page is watched by the user (or may be watched), 
update the timestamp
-               if ( $mode === self::DEFERRED && $wgActivityUpdatesUseJobQueue 
) {
-                       JobQueueGroup::singleton()->push(
-                               EnqueueJob::newFromLocalJobs( new 
JobSpecification(
-                                       'activityUpdateJob',
-                                       array(
-                                               'type'      => 
'updateWatchlistNotification',
-                                               'userid'    => 
$this->getUserId(),
-                                               'notifTime' => 
$notificationTimestamp,
-                                               'curTime'   => time()
-                                       ),
-                                       array( 'removeDuplicates' => true ),
-                                       $title
-                               ) )
+               if ( $mode === self::DEFERRED ) {
+                       $job = new ActivityUpdateJob(
+                               $title,
+                               array(
+                                       'type'      => 
'updateWatchlistNotification',
+                                       'userid'    => $this->getUserId(),
+                                       'notifTime' => $notificationTimestamp,
+                                       'curTime'   => time()
+                               )
                        );
+                       // Try to run this post-send
+                       DeferredUpdates::addCallableUpdate( function() use ( 
$job ) {
+                               $job->run();
+                       } );
                } else {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update( 'watchlist',

-- 
To view, visit https://gerrit.wikimedia.org/r/224978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb8b6aaeb496a4ff3cd3a7e20cdbea0c7dabd677
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to