mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 16:37:13 +02:00
Revert poll message ID changes (going with a different approach)
*** Reason for rollback *** Going with a safer approach to using fresh poll message IDs that doesn't mutate domains themselves. *** Original change description *** Use PollMessage IDs that are globally unique across all time The previous functionality was reusing the same PollMessage ID for Autorenews every year. This can potentially cause confusion at registrars if they were expecting these to be globall unique across all time. So this change simply changes the ID during autorenew. *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177081870
This commit is contained in:
parent
38b2cb13bf
commit
0935ba6450
5 changed files with 11 additions and 134 deletions
|
@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkState;
|
|||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.poll.PollFlowUtils.getPollMessagesQuery;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_NO_MESSAGES;
|
||||
import static google.registry.model.ofy.ObjectifyService.allocateId;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.util.DateTimeUtils.isBeforeOrAt;
|
||||
|
||||
|
@ -32,7 +31,6 @@ import google.registry.flows.ExtensionManager;
|
|||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.PollMessageId;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.poll.MessageQueueInfo;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
|
@ -107,23 +105,14 @@ public class PollAckFlow implements TransactionalFlow {
|
|||
// Move the eventTime of this autorenew poll message forward by a year.
|
||||
DateTime nextEventTime = autorenewPollMessage.getEventTime().plusYears(1);
|
||||
|
||||
// Delete the existing poll message, then optionally create a new one (with a different ID, to
|
||||
// preserve global uniqueness of poll messages across all time) if there are more events to be
|
||||
// delivered.
|
||||
ofy().delete().entity(autorenewPollMessage);
|
||||
// If the next event falls within the bounds of the end time, then just update the eventTime
|
||||
// and re-save it for future autorenew poll messages to be delivered. Otherwise, this
|
||||
// autorenew poll message has no more events to deliver and should be deleted.
|
||||
if (nextEventTime.isBefore(autorenewPollMessage.getAutorenewEndTime())) {
|
||||
PollMessage.Autorenew newAutorenewPollMessage =
|
||||
autorenewPollMessage
|
||||
.asBuilder()
|
||||
.setId(allocateId())
|
||||
.setEventTime(nextEventTime)
|
||||
.build();
|
||||
Key<DomainResource> domainKey = autorenewPollMessage.getParentKey().getParent();
|
||||
DomainResource domain = ofy().load().key(domainKey).now();
|
||||
DomainResource updatedDomain =
|
||||
domain.asBuilder().setAutorenewPollMessage(Key.create(newAutorenewPollMessage)).build();
|
||||
ofy().save().entities(newAutorenewPollMessage, updatedDomain);
|
||||
ofy().save().entity(autorenewPollMessage.asBuilder().setEventTime(nextEventTime).build());
|
||||
includeAckedMessageInCount = isBeforeOrAt(nextEventTime, now);
|
||||
} else {
|
||||
ofy().delete().entity(autorenewPollMessage);
|
||||
}
|
||||
}
|
||||
// We need to return the new queue length. If this was the last message in the queue being
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue