mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Cache Registrars in memory
This replaces the memcache caching, which we think is overall a bad idea. We load all registrars at once instead of caching each as needed, so that the loadAllCached() methods can be cached as well, and therefore will always produce results consistent with loadByClientIdCached()'s view of the registrar's values. All of our prod registrars together total 300k of data right now, so this is hardly worth optimizing further, and in any case this will likely reduce latency even further since most requests will be served out of memory. While I was in the Registrar file I standardized the error messages for incorrect password and clientId length to be the same format, and cleaned up a few random things I noticed in the code. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=156151828
This commit is contained in:
parent
9a48aae107
commit
c9d7e75946
17 changed files with 149 additions and 179 deletions
|
@ -230,7 +230,7 @@ public class DomainFlowUtils {
|
|||
/** Check if the registrar running the flow has access to the TLD in question. */
|
||||
public static void checkAllowedAccessToTld(String clientId, String tld)
|
||||
throws EppException {
|
||||
if (!Registrar.loadByClientId(clientId).getAllowedTlds().contains(tld)) {
|
||||
if (!Registrar.loadByClientIdCached(clientId).getAllowedTlds().contains(tld)) {
|
||||
throw new DomainFlowUtils.NotAuthorizedForTldException(tld);
|
||||
}
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ public class DomainFlowUtils {
|
|||
if (isDomainPremium(domainName, priceTime)) {
|
||||
// NB: The load of the Registar object is transactionless, which means that it should hit
|
||||
// memcache most of the time.
|
||||
if (Registrar.loadByClientId(clientId).getBlockPremiumNames()) {
|
||||
if (Registrar.loadByClientIdCached(clientId).getBlockPremiumNames()) {
|
||||
throw new PremiumNameBlockedException();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue