MergeOp: Hold onto timestamp from submissionId

Although we've been moving away from instance state in MergeOp, we
still need the submissionId for logging purposes. This was already
grabbing a timestamp; hold onto that so we can later use it in
constructing BatchUpdates.

Change-Id: Ic6d52fcfea271a4c80e15528c81a10b9e06c3207
This commit is contained in:
Dave Borowitz 2016-01-12 14:15:29 -05:00
parent 519c44491f
commit 9fc3ee97a4

View File

@ -274,7 +274,7 @@ public class MergeOp implements AutoCloseable {
} }
MACHINE_ID = id; MACHINE_ID = id;
} }
private String staticSubmissionId; private Timestamp ts;
private String submissionId; private String submissionId;
private ReviewDb db; private ReviewDb db;
@ -467,9 +467,9 @@ public class MergeOp implements AutoCloseable {
Hasher h = Hashing.sha1().newHasher(); Hasher h = Hashing.sha1().newHasher();
h.putLong(Thread.currentThread().getId()) h.putLong(Thread.currentThread().getId())
.putUnencodedChars(MACHINE_ID); .putUnencodedChars(MACHINE_ID);
staticSubmissionId = h.hash().toString().substring(0, 8); ts = TimeUtil.nowTs();
submissionId = change.getId().get() + "-" + TimeUtil.nowMs() + submissionId = change.getId().get() + "-" + ts.getTime() +
"-" + staticSubmissionId; "-" + h.hash().toString().substring(0, 8);
} }
public void merge(ReviewDb db, Change change, IdentifiedUser caller, public void merge(ReviewDb db, Change change, IdentifiedUser caller,