mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Remove reference to TLD in Locks' ResourceName
The TLD is added separately to the lock (the lock is unique per TLD-ResourceName pair), so there's no need to add it to the resourceName. The current status is that the TLD was included twice in the lockId. After the fix - it'll only be included once. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172659986
This commit is contained in:
parent
e62e1af863
commit
06f0ec4f2f
3 changed files with 8 additions and 12 deletions
|
@ -22,8 +22,6 @@ import google.registry.model.common.Cursor.CursorType;
|
|||
import google.registry.model.registry.Registry;
|
||||
import google.registry.request.HttpException.NoContentException;
|
||||
import google.registry.request.HttpException.ServiceUnavailableException;
|
||||
import google.registry.request.Parameter;
|
||||
import google.registry.request.RequestParameters;
|
||||
import google.registry.request.lock.LockHandler;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.FormattingLogger;
|
||||
|
@ -70,7 +68,6 @@ class EscrowTaskRunner {
|
|||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
|
||||
@Inject Clock clock;
|
||||
@Inject @Parameter(RequestParameters.PARAM_TLD) String tld;
|
||||
@Inject LockHandler lockHandler;
|
||||
@Inject EscrowTaskRunner() {}
|
||||
|
||||
|
@ -113,12 +110,13 @@ class EscrowTaskRunner {
|
|||
});
|
||||
return null;
|
||||
};
|
||||
String lockName = String.format("%s %s", task.getClass().getSimpleName(), registry.getTld());
|
||||
if (!lockHandler.executeWithLocks(lockRunner, tld, timeout, lockName)) {
|
||||
String lockName = String.format("EscrowTaskRunner %s", task.getClass().getSimpleName());
|
||||
if (!lockHandler.executeWithLocks(lockRunner, registry.getTldStr(), timeout, lockName)) {
|
||||
// This will happen if either: a) the task is double-executed; b) the task takes a long time
|
||||
// to run and the retry task got executed while the first one is still running. In both
|
||||
// situations the safest thing to do is to just return 503 so the task gets retried later.
|
||||
throw new ServiceUnavailableException("Lock in use: " + lockName);
|
||||
throw new ServiceUnavailableException(
|
||||
String.format("Lock in use: %s for TLD: %s", lockName, registry.getTldStr()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue