Remove unnecessary overload of AsyncTaskEnqueuer.enqueueAsyncResave() (#2083)

It was only called in one place (in actual production code), and it was just
slightly obscuring the fact that re-saves can be scheduled for multiple points
in the future in a way that wasn't amazingly helpful to understanding of the
system logic at the callsite.
This commit is contained in:
Ben McIlwain 2023-07-24 13:37:36 -04:00 committed by GitHub
parent 311d5ac9b6
commit 5f5cb8df9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View file

@ -50,12 +50,6 @@ public final class AsyncTaskEnqueuer {
this.cloudTasksUtils = cloudTasksUtils; this.cloudTasksUtils = cloudTasksUtils;
} }
/** Enqueues a task to asynchronously re-save an entity at some point in the future. */
public void enqueueAsyncResave(
VKey<? extends EppResource> entityToResave, DateTime now, DateTime whenToResave) {
enqueueAsyncResave(entityToResave, now, ImmutableSortedSet.of(whenToResave));
}
/** /**
* Enqueues a task to asynchronously re-save an entity at some point(s) in the future. * Enqueues a task to asynchronously re-save an entity at some point(s) in the future.
* *

View file

@ -38,6 +38,7 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import google.registry.batch.AsyncTaskEnqueuer; import google.registry.batch.AsyncTaskEnqueuer;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
@ -286,7 +287,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
.build(); .build();
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, period); DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, period);
asyncTaskEnqueuer.enqueueAsyncResave(newDomain.createVKey(), now, automaticTransferTime); asyncTaskEnqueuer.enqueueAsyncResave(
newDomain.createVKey(), now, ImmutableSortedSet.of(automaticTransferTime));
tm().putAll( tm().putAll(
new ImmutableSet.Builder<>() new ImmutableSet.Builder<>()
.add(newDomain, domainHistory, requestPollMessage) .add(newDomain, domainHistory, requestPollMessage)

View file

@ -69,7 +69,7 @@ public class AsyncTaskEnqueuerTest {
void test_enqueueAsyncResave_success() { void test_enqueueAsyncResave_success() {
Contact contact = persistActiveContact("jd23456"); Contact contact = persistActiveContact("jd23456");
asyncTaskEnqueuer.enqueueAsyncResave( asyncTaskEnqueuer.enqueueAsyncResave(
contact.createVKey(), clock.nowUtc(), clock.nowUtc().plusDays(5)); contact.createVKey(), clock.nowUtc(), ImmutableSortedSet.of(clock.nowUtc().plusDays(5)));
cloudTasksHelper.assertTasksEnqueued( cloudTasksHelper.assertTasksEnqueued(
QUEUE_ASYNC_ACTIONS, QUEUE_ASYNC_ACTIONS,
new CloudTasksHelper.TaskMatcher() new CloudTasksHelper.TaskMatcher()
@ -108,7 +108,7 @@ public class AsyncTaskEnqueuerTest {
void test_enqueueAsyncResave_ignoresTasksTooFarIntoFuture() { void test_enqueueAsyncResave_ignoresTasksTooFarIntoFuture() {
Contact contact = persistActiveContact("jd23456"); Contact contact = persistActiveContact("jd23456");
asyncTaskEnqueuer.enqueueAsyncResave( asyncTaskEnqueuer.enqueueAsyncResave(
contact.createVKey(), clock.nowUtc(), clock.nowUtc().plusDays(31)); contact.createVKey(), clock.nowUtc(), ImmutableSortedSet.of(clock.nowUtc().plusDays(31)));
cloudTasksHelper.assertNoTasksEnqueued(QUEUE_ASYNC_ACTIONS); cloudTasksHelper.assertNoTasksEnqueued(QUEUE_ASYNC_ACTIONS);
assertLogMessage(logHandler, Level.INFO, "Ignoring async re-save"); assertLogMessage(logHandler, Level.INFO, "Ignoring async re-save");
} }