Increase dns update failure max retry count (#1781)

This commit is contained in:
sarahcaseybot 2022-09-12 16:17:31 -04:00 committed by GitHub
parent a4b112b473
commit 5739740ccd
2 changed files with 16 additions and 5 deletions

View file

@ -81,7 +81,7 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
// tasks. // tasks.
public static final String APP_ENGINE_RETRY_HEADER = "X-AppEngine-TaskRetryCount"; public static final String APP_ENGINE_RETRY_HEADER = "X-AppEngine-TaskRetryCount";
public static final String CLOUD_TASKS_RETRY_HEADER = "X-CloudTasks-TaskRetryCount"; public static final String CLOUD_TASKS_RETRY_HEADER = "X-CloudTasks-TaskRetryCount";
public static final int RETRIES_BEFORE_PERMANENT_FAILURE = 10; public static final int RETRIES_BEFORE_PERMANENT_FAILURE = 20;
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();

View file

@ -23,6 +23,7 @@ import static google.registry.dns.DnsModule.PARAM_LOCK_INDEX;
import static google.registry.dns.DnsModule.PARAM_NUM_PUBLISH_LOCKS; import static google.registry.dns.DnsModule.PARAM_NUM_PUBLISH_LOCKS;
import static google.registry.dns.DnsModule.PARAM_PUBLISH_TASK_ENQUEUED; import static google.registry.dns.DnsModule.PARAM_PUBLISH_TASK_ENQUEUED;
import static google.registry.dns.DnsModule.PARAM_REFRESH_REQUEST_CREATED; import static google.registry.dns.DnsModule.PARAM_REFRESH_REQUEST_CREATED;
import static google.registry.dns.PublishDnsUpdatesAction.RETRIES_BEFORE_PERMANENT_FAILURE;
import static google.registry.request.RequestParameters.PARAM_TLD; import static google.registry.request.RequestParameters.PARAM_TLD;
import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.createTld;
import static google.registry.testing.DatabaseHelper.persistActiveDomain; import static google.registry.testing.DatabaseHelper.persistActiveDomain;
@ -392,10 +393,13 @@ public class PublishDnsUpdatesActionTest {
} }
@Test @Test
void testTaskFailsAfterTenRetries_doesNotRetry() { void testTaskFailsAfterMaxRetries_doesNotRetry() {
action = action =
createAction( createAction(
"xn--q9jyb4c", ImmutableSet.of(), ImmutableSet.of("ns1.example.xn--q9jyb4c"), 10); "xn--q9jyb4c",
ImmutableSet.of(),
ImmutableSet.of("ns1.example.xn--q9jyb4c"),
RETRIES_BEFORE_PERMANENT_FAILURE);
doThrow(new RuntimeException()).when(dnsWriter).commit(); doThrow(new RuntimeException()).when(dnsWriter).commit();
action.run(); action.run();
cloudTasksHelper.assertNoTasksEnqueued(DNS_PUBLISH_PUSH_QUEUE_NAME); cloudTasksHelper.assertNoTasksEnqueued(DNS_PUBLISH_PUSH_QUEUE_NAME);
@ -405,7 +409,11 @@ public class PublishDnsUpdatesActionTest {
@Test @Test
void testDomainDnsUpdateRetriesExhausted_emailIsSent() { void testDomainDnsUpdateRetriesExhausted_emailIsSent() {
action = action =
createAction("xn--q9jyb4c", ImmutableSet.of("example.xn--q9jyb4c"), ImmutableSet.of(), 10); createAction(
"xn--q9jyb4c",
ImmutableSet.of("example.xn--q9jyb4c"),
ImmutableSet.of(),
RETRIES_BEFORE_PERMANENT_FAILURE);
doThrow(new RuntimeException()).when(dnsWriter).commit(); doThrow(new RuntimeException()).when(dnsWriter).commit();
action.run(); action.run();
ArgumentCaptor<EmailMessage> contentCaptor = ArgumentCaptor.forClass(EmailMessage.class); ArgumentCaptor<EmailMessage> contentCaptor = ArgumentCaptor.forClass(EmailMessage.class);
@ -423,7 +431,10 @@ public class PublishDnsUpdatesActionTest {
void testHostDnsUpdateRetriesExhausted_emailIsSent() { void testHostDnsUpdateRetriesExhausted_emailIsSent() {
action = action =
createAction( createAction(
"xn--q9jyb4c", ImmutableSet.of(), ImmutableSet.of("ns1.example.xn--q9jyb4c"), 10); "xn--q9jyb4c",
ImmutableSet.of(),
ImmutableSet.of("ns1.example.xn--q9jyb4c"),
RETRIES_BEFORE_PERMANENT_FAILURE);
doThrow(new RuntimeException()).when(dnsWriter).commit(); doThrow(new RuntimeException()).when(dnsWriter).commit();
action.run(); action.run();
ArgumentCaptor<EmailMessage> contentCaptor = ArgumentCaptor.forClass(EmailMessage.class); ArgumentCaptor<EmailMessage> contentCaptor = ArgumentCaptor.forClass(EmailMessage.class);