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

Change subject: Adjust check for failed job queue push in dispatch changes and 
update move
......................................................................


Adjust check for failed job queue push in dispatch changes and update move

Change accordingly with I67400ba in core and make more robust in case,
useless true return value is removed in JobQueueGroup::push.

Keep backwards compatibility with 1.23 with strict comparison
for false return value on error.

Change-Id: I218b186361d72053878dc7021d5d37b4d6c11139
(cherry picked from commit db190cfe39cce5366965896c0a5bb5bc240273fe)
---
M client/includes/UpdateRepo.php
M lib/maintenance/dispatchChanges.php
2 files changed, 18 insertions(+), 4 deletions(-)

Approvals:
  Aude: Looks good to me, approved
  WikidataJenkins: Verified
  jenkins-bot: Verified



diff --git a/client/includes/UpdateRepo.php b/client/includes/UpdateRepo.php
index ef87113..2d07d86 100644
--- a/client/includes/UpdateRepo.php
+++ b/client/includes/UpdateRepo.php
@@ -135,10 +135,17 @@
                $job = $this->createJob();
 
                wfProfileIn( __METHOD__ . '#push' );
-               $ok = $jobQueueGroup->push( $job );
+               $result = $jobQueueGroup->push( $job );
                wfProfileOut( __METHOD__ . '#push' );
 
-               if ( !$ok ) {
+               // MediaWiki 1.24+ throws exceptions on error instead of 
returning false,
+               // but JobQueueGroup::push returns a useless true value.
+               //
+               // We do explicit check for false, for backwards compatibility 
with MediaWiki 1.23
+               // and to make robust in case the useless true return value is 
removed in core.
+               //
+               // @todo The check can be removed when we do not support 1.23 
anymore.
+               if ( $result === false ) {
                        wfProfileOut( __METHOD__ );
                        throw new RuntimeException( "Failed to push job to job 
queue" );
                }
diff --git a/lib/maintenance/dispatchChanges.php 
b/lib/maintenance/dispatchChanges.php
index bce8860c..b660a13 100644
--- a/lib/maintenance/dispatchChanges.php
+++ b/lib/maintenance/dispatchChanges.php
@@ -958,10 +958,17 @@
                wfProfileOut( __METHOD__ . '#job' );
 
                wfProfileIn( __METHOD__ . '#push' );
-               $ok = $qgroup->push( $job );
+               $result = $qgroup->push( $job );
                wfProfileOut( __METHOD__ . '#push' );
 
-               if ( !$ok ) {
+               // MediaWiki 1.24+ throws exceptions on error instead of 
returning false,
+               // but JobQueueGroup::push returns a useless true value.
+               //
+               // We do explicit check for false, for backwards compatibility 
with MediaWiki 1.23
+               // and to make robust in case the useless true return value is 
removed in core.
+               //
+               // @todo The check can be removed when we do not support 1.23 
anymore.
+               if ( $result === false ) {
                        wfProfileOut( __METHOD__ );
                        throw new \MWException( "Failed to push to job queue 
for $wikiDB" );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I218b186361d72053878dc7021d5d37b4d6c11139
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.24-wmf2
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to