Ppchelko has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393199 )

Change subject: Remove usage of EnqueueJob
......................................................................

Remove usage of EnqueueJob

Since the flaggedrev_CacheUpdate job was moved to the
kafka JobQueue the usage of EnqueueJob became unnesessary.
Initially it was designed to post cross-DC jobs, but in the
new infrastructure it's not needed, cross-DC is handled by
the JobQueue itself.

Additionally, the Job contract requires the job to return
a boolean indicating if the job execution was successfull
or a job should be retried. Added return statements everywhere.

Bug: T181216
Change-Id: I79167ee190120b4ef9220ff906635003e7b2439e
---
M backend/FRDependencyUpdate.php
M backend/FRExtraCacheUpdateJob.php
M backend/FlaggableWikiPage.php
3 files changed, 14 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FlaggedRevs 
refs/changes/99/393199/1

diff --git a/backend/FRDependencyUpdate.php b/backend/FRDependencyUpdate.php
index 3e8714a..5f552b8 100644
--- a/backend/FRDependencyUpdate.php
+++ b/backend/FRDependencyUpdate.php
@@ -66,14 +66,12 @@
                if ( $existing != $deps ) {
                        if ( $mode === self::DEFERRED ) {
                                # Let the job queue parse and update
-                               JobQueueGroup::singleton()->push( 
EnqueueJob::newFromLocalJobs(
-                                       new JobSpecification(
-                                               'flaggedrevs_CacheUpdate',
-                                               [ 'type' => 'updatelinks' ],
-                                               [ 'removeDuplicates' => true ],
-                                               $this->title
+                               JobQueueGroup::singleton()->push(
+                                       new FRExtraCacheUpdateJob(
+                                               $this->title,
+                                               [ 'type' => 'updatelinks' ]
                                        )
-                               ) );
+                               );
 
                                return;
                        }
diff --git a/backend/FRExtraCacheUpdateJob.php 
b/backend/FRExtraCacheUpdateJob.php
index cf342e4..69236b2 100644
--- a/backend/FRExtraCacheUpdateJob.php
+++ b/backend/FRExtraCacheUpdateJob.php
@@ -60,18 +60,19 @@
                                $frDepUpdate = new FRDependencyUpdate( 
$this->title, $stableOut );
                                $frDepUpdate->doUpdate( 
FRDependencyUpdate::IMMEDIATE );
 
-                               return;
+                               return true;
                        }
                }
 
                // If not page or revision was found, remove the stable-only 
links
                FlaggedRevs::clearStableOnlyDeps( $fpage->getId() );
+               return true;
        }
 
        protected function doUpdateSyncState() {
                $fpage = FlaggableWikiPage::getTitleInstance( $this->title );
                if ( !$fpage->getId() || !$fpage->getStable() ) {
-                       return;
+                       return true;
                }
 
                $synced = $fpage->stableVersionIsSynced();
@@ -83,5 +84,6 @@
                                __METHOD__
                        );
                }
+               return true;
        }
 }
diff --git a/backend/FlaggableWikiPage.php b/backend/FlaggableWikiPage.php
index 04256fe..49d05f6 100644
--- a/backend/FlaggableWikiPage.php
+++ b/backend/FlaggableWikiPage.php
@@ -342,14 +342,12 @@
                        return;
                }
 
-               JobQueueGroup::singleton()->push( EnqueueJob::newFromLocalJobs(
-                       new JobSpecification(
-                               'flaggedrevs_CacheUpdate',
-                               [ 'type' => 'updatesyncstate' ],
-                               [ 'removeDuplicates' => true ],
-                               $this->getTitle()
+               JobQueueGroup::singleton()->push(
+                       new FRExtraCacheUpdateJob(
+                               $this->getTitle(),
+                               [ 'type' => 'updatesyncstate' ]
                        )
-               ) );
+               );
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79167ee190120b4ef9220ff906635003e7b2439e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FlaggedRevs
Gerrit-Branch: master
Gerrit-Owner: Ppchelko <ppche...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to