aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-03-16 13:13:41 +0000
committerDave Whiteland <dave@mysociety.org>2012-03-23 13:45:38 +0000
commit3d711d1ec46d2ea15ab7c1e9e5d5ae5da33e90b1 (patch)
tree93a17d30828ef037cc3da7282f1c08bb5bd2c479
parentb568ab6b4f169b3afda44047d40f071f90cab099 (diff)
don't report individual send-reports failures (unless verbose), just totals that have utterly failed
-rwxr-xr-xbin/send-reports19
1 files changed, 17 insertions, 2 deletions
diff --git a/bin/send-reports b/bin/send-reports
index db9a7f3df..a0c084c1c 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -57,6 +57,9 @@ my $unsent = FixMyStreet::App->model("DB::Problem")->search( {
whensent => undef,
council => { '!=', undef },
} );
+
+my %sending_skipped_by_method = ();
+
my (%notgot, %note);
while (my $row = $unsent->next) {
@@ -296,8 +299,8 @@ while (my $row = $unsent->next) {
} elsif ($send_method eq SEND_METHOD_BARNET) {
$h{message} = construct_barnet_message(%h);
if (!$nomail) {
- if (my $err_msg = does_exceed_cutoff_limit($row, "barnet")) {
- print "$err_msg\n"; # if $verbose
+ if (my $cutoff_msg = does_exceed_cutoff_limit($row, "barnet")) {
+ print "$cutoff_msg\n" if $verbose;
} else {
my ($barnet_result, $err_msg) = post_barnet_message( $row, %h );
update_send_fail_data($row, $err_msg) if $barnet_result;
@@ -372,6 +375,17 @@ if ($verbose) {
}
}
+# not conditional on verbose because these can be considered failures (more relevant than one-off error messages?)
+if (keys %sending_skipped_by_method) {
+ my $c = 0;
+ print "\nProblem reports that send-reports did not attempt to send because retries >= " . SEND_FAIL_RETRIES_CUTOFF . ":\n";
+ foreach my $send_method (sort keys %sending_skipped_by_method) {
+ printf " %-24s %4d\n", "$send_method:", $sending_skipped_by_method{$send_method};
+ $c+=$sending_skipped_by_method{$send_method};
+ }
+ printf " %-24s %4d\n", "Total:", $c;
+}
+
sub _get_district_for_contact {
my ( $lat, $lon ) = @_;
my $district =
@@ -714,6 +728,7 @@ sub does_exceed_cutoff_limit {
my ($problem, $council_name) = @_;
my $err_msg = "";
if ($problem->send_fail_count >= SEND_FAIL_RETRIES_CUTOFF) {
+ $sending_skipped_by_method{$council_name || '?'}++;
$council_name &&= " to $council_name";
$err_msg = "skipped: problem id=" . $problem->id . " send$council_name has failed "
. $problem->send_fail_count . " times, cutoff is " . SEND_FAIL_RETRIES_CUTOFF;