mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +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
|
@ -23,6 +23,7 @@ import com.beust.jcommander.Parameter;
|
|||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
|
@ -103,10 +104,13 @@ final class VerifyOteCommand implements ServerSideCommand {
|
|||
* prefixes of those accounts (in this case, regname).
|
||||
*/
|
||||
private ImmutableSet<String> getAllRegistrarNames() {
|
||||
return Registrar.loadAllActive()
|
||||
return FluentIterable.from(Registrar.loadAll())
|
||||
.transform(new Function<Registrar, String>() {
|
||||
@Override
|
||||
public String apply(Registrar registrar) {
|
||||
if (!registrar.isActive()) {
|
||||
return null;
|
||||
}
|
||||
String name = registrar.getClientId();
|
||||
// Look for names of the form "regname-1", "regname-2", etc. and strip the -# suffix.
|
||||
String replacedName = name.replaceFirst("^(.*)-[1234]$", "$1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue