mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 19:20:44 +02:00
Lower the isolation level for RefreshDnsForAllDomainsAction (#2182)
* Lower the isolation level for RefreshDnsForAllDomainsAction This lowers the isolation level to TRANSACTION_REPEATABLE_READ which will hopefully allow the action to run the entire action without timing out on our larger TLDs. * Unchange default config
This commit is contained in:
parent
b1ec81f054
commit
2facedd60f
1 changed files with 6 additions and 2 deletions
|
@ -19,6 +19,7 @@ import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||||
import static com.google.common.collect.Iterables.getLast;
|
import static com.google.common.collect.Iterables.getLast;
|
||||||
import static google.registry.dns.DnsUtils.requestDomainDnsRefresh;
|
import static google.registry.dns.DnsUtils.requestDomainDnsRefresh;
|
||||||
import static google.registry.model.tld.Tlds.assertTldsExist;
|
import static google.registry.model.tld.Tlds.assertTldsExist;
|
||||||
|
import static google.registry.persistence.PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ;
|
||||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||||
import static google.registry.request.RequestParameters.PARAM_TLDS;
|
import static google.registry.request.RequestParameters.PARAM_TLDS;
|
||||||
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
import static google.registry.util.DateTimeUtils.END_OF_TIME;
|
||||||
|
@ -82,13 +83,16 @@ public class RefreshDnsForAllDomainsAction implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
assertTldsExist(tlds);
|
assertTldsExist(tlds);
|
||||||
checkArgument(batchSize > 0, "Must specify a positive number for batch size");
|
checkArgument(batchSize > 0, "Must specify a positive number for batch size");
|
||||||
int smearMinutes = tm().transact(this::calculateSmearMinutes);
|
int smearMinutes = tm().transact(this::calculateSmearMinutes, TRANSACTION_REPEATABLE_READ);
|
||||||
|
|
||||||
ImmutableList<String> domainsBatch;
|
ImmutableList<String> domainsBatch;
|
||||||
@Nullable String lastInPreviousBatch = null;
|
@Nullable String lastInPreviousBatch = null;
|
||||||
do {
|
do {
|
||||||
Optional<String> lastInPreviousBatchOpt = Optional.ofNullable(lastInPreviousBatch);
|
Optional<String> lastInPreviousBatchOpt = Optional.ofNullable(lastInPreviousBatch);
|
||||||
domainsBatch = tm().transact(() -> refreshBatch(lastInPreviousBatchOpt, smearMinutes));
|
domainsBatch =
|
||||||
|
tm().transact(
|
||||||
|
() -> refreshBatch(lastInPreviousBatchOpt, smearMinutes),
|
||||||
|
TRANSACTION_REPEATABLE_READ);
|
||||||
lastInPreviousBatch = domainsBatch.isEmpty() ? null : getLast(domainsBatch);
|
lastInPreviousBatch = domainsBatch.isEmpty() ? null : getLast(domainsBatch);
|
||||||
} while (domainsBatch.size() == batchSize);
|
} while (domainsBatch.size() == batchSize);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue