diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-03-16 16:02:17 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-03-31 09:48:46 +0100 |
commit | 0236c8b902f18735006767c94ced9e2f1fdc851f (patch) | |
tree | 3872c314240b5f9b09e77eefd4d4cd7def1f0fe6 | |
parent | b41b93606ebbb2272c05ecacc975fbb9901349c4 (diff) |
Move summary failures to separate script.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rwxr-xr-x | bin/send-reports-failure-summary | 20 | ||||
-rw-r--r-- | conf/crontab-example | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Reports.pm | 2 |
4 files changed, 23 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a997a699..3d76612cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Provide access to staff-only categories in admin. - Development improvements: - Refactor Script::Report into an object. + - Move summary failures to a separate script. - UK: - Added junction lookup, so you can search for things like "M60, Junction 2" diff --git a/bin/send-reports-failure-summary b/bin/send-reports-failure-summary new file mode 100755 index 000000000..c7a5b4086 --- /dev/null +++ b/bin/send-reports-failure-summary @@ -0,0 +1,20 @@ +#!/usr/bin/env perl + +# send-reports-failure-summary: +# Prints a summary of report sending failures + +use strict; +use warnings; +use v5.14; + +BEGIN { + use File::Basename qw(dirname); + use File::Spec; + my $d = dirname(File::Spec->rel2abs($0)); + require "$d/../setenv.pl"; +} + +use FixMyStreet::Script::Reports; + +my $manager = FixMyStreet::Script::Reports->new; +$manager->end_summary_failures; diff --git a/conf/crontab-example b/conf/crontab-example index f06144699..2bc51f20a 100644 --- a/conf/crontab-example +++ b/conf/crontab-example @@ -11,9 +11,8 @@ PATH=/usr/local/bin:/usr/bin:/bin # send-reports has three rows so that its 8am entry can be run with --verbose to send a morning summary of anything that's gone wrong -5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$FMS/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" -0 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" -0 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports --verbose" || echo "stalled?" +*/5 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/send-reports" || echo "stalled?" +0 8 * * * "$FMS/bin/send-reports-failure-summary" 2 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-alerts.lock" "$FMS/bin/send-alerts" || echo "stalled?" 22,52 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-questionnaires.lock" "$FMS/bin/send-questionnaires" || echo "stalled?" diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm index fbf437c0c..2b558fdc0 100644 --- a/perllib/FixMyStreet/Script/Reports.pm +++ b/perllib/FixMyStreet/Script/Reports.pm @@ -51,7 +51,6 @@ sub send(;$) { $manager->end_debug_line; $manager->end_summary_unconfirmed; - $manager->end_summary_failures; return $manager->test_data; } @@ -84,7 +83,6 @@ sub end_summary_unconfirmed { sub end_summary_failures { my $self = shift; - return unless $self->verbose || $self->debug_mode; my $sending_errors = ''; my $unsent = FixMyStreet::DB->resultset('Problem')->search( { |