[JobQueue] Allow certain job types to always opt out of retries.
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 20 Feb 2013 00:56:47 +0000 (16:56 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 20 Feb 2013 00:58:34 +0000 (16:58 -0800)
Change-Id: I4cdd43b0b248700e199947e99d2df32b91e23ef7

includes/job/Job.php
maintenance/runJobs.php

index 24e9093..9ec58c9 100644 (file)
@@ -177,12 +177,19 @@ abstract class Job {
        }
 
        /**
-        * @return bool
+        * @return bool Whether only one of each identical set of jobs should be run
         */
        public function ignoreDuplicates() {
                return $this->removeDuplicates;
        }
 
+       /**
+        * @return bool Whether this job can be retried on failure by job runners
+        */
+       public function allowRetries() {
+               return true;
+       }
+
        /**
         * Subclasses may need to override this to make duplication detection work
         *
index f64b5e8..ff09683 100644 (file)
@@ -96,7 +96,7 @@ class RunJobs extends Maintenance {
                                        wfWarn( $job->getType() . " job failed to return a boolean." );
                                        $status = true; // sanity
                                }
-                               if ( $status ) {
+                               if ( $status || !$job->allowRetries() ) {
                                        $group->ack( $job ); // done
                                }