Add success/failure notifications for the RelockDomainAction (#733)

* Add success/failure notifications for the RelockDomainAction

If a relock fails for some reason, we should noisily notify both our
alerting email and also the registry lock contacts for the registrar in
question. The consequences of a silent failure could be large so it's
something we want to avoid if at all possible.

In addition, we only retry tasks up to two times (one in 5min, one in
10min).

This model of retries / notifications, as well as the language contained
in the emails, have been LGTMed by Bruno and Kirsten

* Change the wording on the success email

* Change the times in which we send emails

For transient failures:
- Retry every ten minutes for six hours
- Send an email after a half hour (three failures) saying that we'll
retry
- Send a success email if we succeed any time after that

For non-transient failures:
Send an email with the error message and don't retry

* Add a test for the max-failure-email

* Responses to CR

- retry indefinitely
- send an email to just the alert address if we can't find the lock
- refactor the task enqueuer a bit

* non-transient -> non-retryable

* Use a lenient stubber for the AESU

* Add a DS transaction around the re-lock
This commit is contained in:
gbrodman 2020-08-31 14:15:47 -04:00 committed by GitHub
parent 88c5b840c5
commit 0e685940d8
7 changed files with 435 additions and 94 deletions

View file

@ -16,6 +16,7 @@ package google.registry.util;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.net.MediaType;
import java.util.Collection;
import java.util.Optional;
@ -27,10 +28,10 @@ public abstract class EmailMessage {
public abstract String subject();
public abstract String body();
public abstract ImmutableList<InternetAddress> recipients();
public abstract ImmutableSet<InternetAddress> recipients();
public abstract InternetAddress from();
public abstract ImmutableList<InternetAddress> bccs();
public abstract ImmutableSet<InternetAddress> bccs();
public abstract Optional<MediaType> contentType();
public abstract Optional<Attachment> attachment();
@ -63,9 +64,9 @@ public abstract class EmailMessage {
public abstract Builder setContentType(MediaType contentType);
public abstract Builder setAttachment(Attachment attachment);
abstract ImmutableList.Builder<InternetAddress> recipientsBuilder();
abstract ImmutableSet.Builder<InternetAddress> recipientsBuilder();
abstract ImmutableList.Builder<InternetAddress> bccsBuilder();
abstract ImmutableSet.Builder<InternetAddress> bccsBuilder();
public Builder addRecipient(InternetAddress value) {
recipientsBuilder().add(value);