summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Job
diff options
context:
space:
mode:
authorPerl Tidy <perltidy@bugzilla.org>2018-12-05 21:38:52 +0100
committerDylan William Hardison <dylan@hardison.net>2018-12-05 23:49:08 +0100
commit8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch)
tree9d270f173330ca19700e0ba9f2ee931300646de1 /Bugzilla/Job
parenta7bb5a65b71644d9efce5fed783ed545b9336548 (diff)
downloadbugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz
bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'Bugzilla/Job')
-rw-r--r--Bugzilla/Job/BugMail.pm4
-rw-r--r--Bugzilla/Job/Mailer.pm40
2 files changed, 23 insertions, 21 deletions
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;