From 8ec8da0491ad89604700b3e29a227966f6d84ba1 Mon Sep 17 00:00:00 2001 From: Perl Tidy Date: Wed, 5 Dec 2018 15:38:52 -0500 Subject: no bug - reformat all the code using the new perltidy rules --- Bugzilla/Job/BugMail.pm | 4 ++-- Bugzilla/Job/Mailer.pm | 40 +++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'Bugzilla/Job') diff --git a/Bugzilla/Job/BugMail.pm b/Bugzilla/Job/BugMail.pm index b4887c470..ebc884a32 100644 --- a/Bugzilla/Job/BugMail.pm +++ b/Bugzilla/Job/BugMail.pm @@ -15,8 +15,8 @@ use Bugzilla::BugMail; BEGIN { eval "use parent qw(Bugzilla::Job::Mailer)"; } sub process_job { - my ($class, $arg) = @_; - Bugzilla::BugMail::dequeue($arg->{vars}); + my ($class, $arg) = @_; + Bugzilla::BugMail::dequeue($arg->{vars}); } 1; diff --git a/Bugzilla/Job/Mailer.pm b/Bugzilla/Job/Mailer.pm index a376a9256..d73e4f009 100644 --- a/Bugzilla/Job/Mailer.pm +++ b/Bugzilla/Job/Mailer.pm @@ -17,40 +17,42 @@ BEGIN { eval "use base qw(TheSchwartz::Worker)"; } # The longest we expect a job to possibly take, in seconds. use constant grab_for => 300; + # We don't want email to fail permanently very easily. Retry for 30 days. use constant max_retries => 725; # The first few retries happen quickly, but after that we wait an hour for # each retry. sub retry_delay { - my ($class, $num_retries) = @_; - if ($num_retries < 5) { - return (10, 30, 60, 300, 600)[$num_retries]; - } - # One hour - return 60*60; + my ($class, $num_retries) = @_; + if ($num_retries < 5) { + return (10, 30, 60, 300, 600)[$num_retries]; + } + + # One hour + return 60 * 60; } sub work { - my ($class, $job) = @_; - eval { $class->process_job($job->arg) }; - if (my $error = $@) { - if ($error eq EMAIL_LIMIT_EXCEPTION) { - $job->declined(); - } - else { - $job->failed($error); - } - undef $@; + my ($class, $job) = @_; + eval { $class->process_job($job->arg) }; + if (my $error = $@) { + if ($error eq EMAIL_LIMIT_EXCEPTION) { + $job->declined(); } else { - $job->completed; + $job->failed($error); } + undef $@; + } + else { + $job->completed; + } } sub process_job { - my ($class, $arg) = @_; - MessageToMTA($arg->{msg}, 1); + my ($class, $arg) = @_; + MessageToMTA($arg->{msg}, 1); } 1; -- cgit v1.2.3-24-g4f1b