mirror of
https://github.com/google/nomulus.git
synced 2025-05-21 03:39:36 +02:00
Fix code to always set HistoryEntry modification time using txn time
Since HistoryEntry always represents a read-only log of mutation to a core resource, that mutation should always happen in a transaction, and the HistoryEntry should be saved in that transaction. As such, it's always more accurate to use ofy().getTransactionTime() for the modificationTime of the HistoryEntry rather than just DateTime.now(UTC). In addition, having these be the exact same timestamp makes it possible to align HistoryEntries with commit log manifests using modificationTime = transactionTime, which is useful for recovery and analysis purposes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170136957
This commit is contained in:
parent
ceadfea11f
commit
2702c3a7f3
3 changed files with 3 additions and 6 deletions
|
@ -19,7 +19,6 @@ import static com.google.common.base.Predicates.not;
|
|||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.rde.imports.RdeImportUtils.generateTridForImport;
|
||||
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
@ -35,7 +34,6 @@ import google.registry.xjc.host.XjcHostStatusType;
|
|||
import google.registry.xjc.rdehost.XjcRdeHost;
|
||||
import google.registry.xjc.rdehost.XjcRdeHostElement;
|
||||
import java.net.InetAddress;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Utility class that converts an {@link XjcRdeHost} into a {@link HostResource}. */
|
||||
public class XjcToHostResourceConverter extends XjcToEppResourceConverter {
|
||||
|
@ -66,7 +64,7 @@ public class XjcToHostResourceConverter extends XjcToEppResourceConverter {
|
|||
.setType(HistoryEntry.Type.RDE_IMPORT)
|
||||
.setClientId(host.getClID())
|
||||
.setTrid(generateTridForImport())
|
||||
.setModificationTime(DateTime.now(UTC))
|
||||
.setModificationTime(ofy().getTransactionTime())
|
||||
.setXmlBytes(getObjectXml(new XjcRdeHostElement(host)))
|
||||
.setBySuperuser(true)
|
||||
.setReason("RDE Import")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue