Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Changes to envoy notification mailing behaviour:
Browse files Browse the repository at this point in the history
 - Trap failure of "ERROR ON ENVOY" mail and fallback to log Dumper
 - Clear users' notification in all cases, since a problematic one can
   cause the whole queue to get stuck, never clear.

The error log fallback *should* be temporary, to figure out what's
actually going on with the "ERROR ON ENVOY" mail, but nothing persists
like a temporary solution - need to keep an eye on it.
  • Loading branch information
jbarrett committed Jun 11, 2014
1 parent 88e54fc commit 9574a25
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions lib/DDGC/Web/Controller/Cronjob.pm
Expand Up @@ -71,28 +71,34 @@ sub notify_cycle {
};
my $err = $@;
if ($err) {
$c->d->postman->mail(
$c->d->config->error_email,
'"DuckDuckGo Community Envoy" <envoy@dukgo.com>',
'[DuckDuckGo Community] ERROR ON ENVOY',
$err,
);
} else {
my @ids;
for (@{$c->stash->{unsent_notifications_results}}) {
for ($_->event_notifications) {
push @ids, $_->id;
}
eval {
$c->d->postman->mail(
$c->d->config->error_email,
'"DuckDuckGo Community Envoy" <envoy@dukgo.com>',
'[DuckDuckGo Community] ERROR ON ENVOY',
$err,
);
};
my $err_report = $@;
if ($err_report) {
$c->d->errorlog("ERROR ON ENVOY");
$c->d->errorlog($err);
$c->d->errorlog($err_report);
}
}
my @ids;
for (@{$c->stash->{unsent_notifications_results}}) {
for ($_->event_notifications) {
push @ids, $_->id;
}
$c->d->rs('Event::Notification')->search({
id => { -in => \@ids },
})->update({ sent => 1 });
}
$c->d->rs('Event::Notification')->search({
id => { -in => \@ids },
})->update({ sent => 1 });
});
}
});
}

}

__PACKAGE__->meta->make_immutable;
Expand Down

0 comments on commit 9574a25

Please sign in to comment.