mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Implement 10 min backoff for failed async deletes
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117945626
This commit is contained in:
parent
85911e0b95
commit
79b2d5a990
3 changed files with 19 additions and 0 deletions
|
@ -256,4 +256,12 @@ public interface RegistryConfig {
|
||||||
* committed, and could potentially miss the reference.
|
* committed, and could potentially miss the reference.
|
||||||
*/
|
*/
|
||||||
public Duration getAsyncDeleteFlowMapreduceDelay();
|
public Duration getAsyncDeleteFlowMapreduceDelay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the amount of time to back off following an async delete flow task failure.
|
||||||
|
*
|
||||||
|
* This should be ~orders of magnitude larger than the rate on the queue, in order to prevent
|
||||||
|
* the logs from filling up with unnecessarily failures.
|
||||||
|
*/
|
||||||
|
public Duration getAsyncDeleteFlowFailureBackoff();
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,4 +193,9 @@ public class TestRegistryConfig implements RegistryConfig {
|
||||||
public Duration getAsyncDeleteFlowMapreduceDelay() {
|
public Duration getAsyncDeleteFlowMapreduceDelay() {
|
||||||
return Duration.standardSeconds(90);
|
return Duration.standardSeconds(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Duration getAsyncDeleteFlowFailureBackoff() {
|
||||||
|
return Duration.standardMinutes(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,13 @@ import static com.google.domain.registry.request.Actions.getPathForAction;
|
||||||
|
|
||||||
import com.google.appengine.api.taskqueue.Queue;
|
import com.google.appengine.api.taskqueue.Queue;
|
||||||
import com.google.appengine.api.taskqueue.QueueFactory;
|
import com.google.appengine.api.taskqueue.QueueFactory;
|
||||||
|
import com.google.appengine.api.taskqueue.RetryOptions;
|
||||||
import com.google.appengine.api.taskqueue.TaskHandle;
|
import com.google.appengine.api.taskqueue.TaskHandle;
|
||||||
import com.google.appengine.api.taskqueue.TaskOptions;
|
import com.google.appengine.api.taskqueue.TaskOptions;
|
||||||
import com.google.appengine.api.taskqueue.TaskOptions.Method;
|
import com.google.appengine.api.taskqueue.TaskOptions.Method;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.domain.registry.config.RegistryEnvironment;
|
||||||
import com.google.domain.registry.mapreduce.MapreduceAction;
|
import com.google.domain.registry.mapreduce.MapreduceAction;
|
||||||
import com.google.domain.registry.util.FormattingLogger;
|
import com.google.domain.registry.util.FormattingLogger;
|
||||||
|
|
||||||
|
@ -48,8 +50,12 @@ public final class AsyncFlowUtils {
|
||||||
Queue queue = QueueFactory.getQueue(ASYNC_FLOW_QUEUE_NAME);
|
Queue queue = QueueFactory.getQueue(ASYNC_FLOW_QUEUE_NAME);
|
||||||
String path = getPathForAction(action);
|
String path = getPathForAction(action);
|
||||||
logger.infofmt("Enqueueing async mapreduce action with path %s and params %s", path, params);
|
logger.infofmt("Enqueueing async mapreduce action with path %s and params %s", path, params);
|
||||||
|
// Aggressively back off if the task fails, to minimize flooding the logs.
|
||||||
|
RetryOptions retryOptions = RetryOptions.Builder.withMinBackoffSeconds(
|
||||||
|
RegistryEnvironment.get().config().getAsyncDeleteFlowFailureBackoff().getStandardSeconds());
|
||||||
TaskOptions options = TaskOptions.Builder
|
TaskOptions options = TaskOptions.Builder
|
||||||
.withUrl(path)
|
.withUrl(path)
|
||||||
|
.retryOptions(retryOptions)
|
||||||
.countdownMillis(executionDelay.getMillis())
|
.countdownMillis(executionDelay.getMillis())
|
||||||
.method(Method.GET);
|
.method(Method.GET);
|
||||||
for (Entry<String, String> entry : params.entrySet()) {
|
for (Entry<String, String> entry : params.entrySet()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue