diff options
author | Struan Donald <struan@exo.org.uk> | 2012-03-22 17:39:52 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-03-22 17:39:52 +0000 |
commit | f2f40810e1599eee52de5a0e496c59ab22244c7c (patch) | |
tree | 363e9a4bfd073c16a8bed2ecc9ce806340be26d6 /bin | |
parent | 832ee711e4b741196146b0218678d34849aa82ff (diff) |
skipped send summary code
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/send-reports | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/send-reports b/bin/send-reports index b2320bb1d..daf091790 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -54,6 +54,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) { @@ -370,6 +373,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 = @@ -551,6 +565,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; |