Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/314217

Change subject: Pass Job success status to teardown callbacks
......................................................................

Pass Job success status to teardown callbacks

Change-Id: Icf2e03efcfd9232fe4ead776096b61cef1c06141
---
M includes/jobqueue/Job.php
M includes/jobqueue/JobRunner.php
2 files changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/17/314217/1

diff --git a/includes/jobqueue/Job.php b/includes/jobqueue/Job.php
index bbd0ddb..e8a8969 100644
--- a/includes/jobqueue/Job.php
+++ b/includes/jobqueue/Job.php
@@ -301,7 +301,9 @@
        }
 
        /**
-        * @param callable $callback
+        * @param callable $callback A function with one parameter, the success 
status, which will be
+        *   false if the job failed or it succeeded but the DB changes could 
not be committed or
+        *   any deferred updates threw and exception. (This parameter was 
added in 1.28.)
         * @since 1.27
         */
        protected function addTeardownCallback( $callback ) {
@@ -313,9 +315,9 @@
         *
         * @since 1.27
         */
-       public function teardown() {
+       public function teardown( $status ) {
                foreach ( $this->teardownCallbacks as $callback ) {
-                       call_user_func( $callback );
+                       call_user_func( $callback, $status  );
                }
        }
 
diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index ed3aa9a..84ded8d 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -283,7 +283,7 @@
                }
                // Always attempt to call teardown() even if Job throws 
exception.
                try {
-                       $job->teardown();
+                       $job->teardown( $status );
                } catch ( Exception $e ) {
                        MWExceptionHandler::logException( $e );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf2e03efcfd9232fe4ead776096b61cef1c06141
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <gti...@wikimedia.org>

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

Reply via email to