From 9e3fb8b93ce67a209376bfd78e7f4bb72e3013ed Mon Sep 17 00:00:00 2001 From: mcilwain Date: Tue, 27 Feb 2018 08:29:47 -0800 Subject: [PATCH] Make the async delete delay configurable in YAML config files Since this has interactions with the recently added EPP resource caching, they both need to be configurable, otherwise the EPP resource caching time could not be set longer than the hard-coded async delete delay. This also adds comments to better clarify the interaction between the two. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=187179539 --- java/google/registry/config/RegistryConfig.java | 4 ++-- java/google/registry/config/RegistryConfigSettings.java | 1 + java/google/registry/config/files/default-config.yaml | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/google/registry/config/RegistryConfig.java b/java/google/registry/config/RegistryConfig.java index 3da7f9abf..8b57a034d 100644 --- a/java/google/registry/config/RegistryConfig.java +++ b/java/google/registry/config/RegistryConfig.java @@ -1026,8 +1026,8 @@ public final class RegistryConfig { */ @Provides @Config("asyncDeleteFlowMapreduceDelay") - public static Duration provideAsyncDeleteFlowMapreduceDelay() { - return Duration.standardSeconds(90); + public static Duration provideAsyncDeleteFlowMapreduceDelay(RegistryConfigSettings config) { + return Duration.standardSeconds(config.misc.asyncDeleteDelaySeconds); } /** diff --git a/java/google/registry/config/RegistryConfigSettings.java b/java/google/registry/config/RegistryConfigSettings.java index 32d233cbc..3245bd18a 100644 --- a/java/google/registry/config/RegistryConfigSettings.java +++ b/java/google/registry/config/RegistryConfigSettings.java @@ -155,6 +155,7 @@ public class RegistryConfigSettings { public String sheetExportId; public String alertRecipientEmailAddress; public String alertEmailSenderDomain; + public int asyncDeleteDelaySeconds; } /** Configuration for Braintree credit card payment processing. */ diff --git a/java/google/registry/config/files/default-config.yaml b/java/google/registry/config/files/default-config.yaml index b8f497f67..f0b96d46e 100644 --- a/java/google/registry/config/files/default-config.yaml +++ b/java/google/registry/config/files/default-config.yaml @@ -155,7 +155,8 @@ caching: eppResourceCachingEnabled: false # Length of time that EPP resource entities and keys are cached in memory - # before expiring. + # before expiring. This should always be shorter than asyncDeleteDelaySeconds, + # to prevent deleted contacts or hosts from being used on domains. eppResourceCachingSeconds: 60 # The maximum number of EPP resource entities and keys to cache in memory. @@ -244,6 +245,11 @@ misc: # Domain for the email address we send alert summary emails from. alertEmailSenderDomain: appspotmail.com + # How long to delay processing of asynchronous deletions. This should always + # be longer than eppResourceCachingSeconds, to prevent deleted contacts or + # hosts from being used on domains. + asyncDeleteDelaySeconds: 90 + # Braintree is a credit card payment processor that is used on the registrar # console to allow registrars to pay their invoices. braintree: