diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /Bugzilla/Job/Mailer.pm | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'Bugzilla/Job/Mailer.pm')
-rw-r--r-- | Bugzilla/Job/Mailer.pm | 40 |
1 files changed, 21 insertions, 19 deletions
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; |