From f8988e0894da8e0cbf809dad5d8bd50b24d9d4ea Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 19 Feb 2013 16:56:47 -0800 Subject: [PATCH] [JobQueue] Allow certain job types to always opt out of retries. Change-Id: I4cdd43b0b248700e199947e99d2df32b91e23ef7 --- includes/job/Job.php | 9 ++++++++- maintenance/runJobs.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/job/Job.php b/includes/job/Job.php index 24e9093622..9ec58c9d1b 100644 --- a/includes/job/Job.php +++ b/includes/job/Job.php @@ -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 * diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index f64b5e82f7..ff096834f2 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -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 } -- 2.20.1