summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@digital.ai>2020-05-22 17:55:39 +0900
committerDavid Pursehouse <dpursehouse@digital.ai>2020-05-22 17:55:39 +0900
commitcb61577630f52e90234f054bf596cc495e12f576 (patch)
tree767fc6f4d27ebdd5e86b610c9e8df7abdd51215c
parent9392d3ba60dfb2d5535ab8080a5d62c2f7994ef5 (diff)
parent2cb6112e081e97d4dfd8e677b6f02c779db95e85 (diff)
Merge branch 'stable-2.16' into stable-3.0v3.0.9
* stable-2.16: Make persistent task keys stable Change-Id: Iefda465c739f4669b5394d3c57f7abe0d7513b5f
-rw-r--r--src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
index 19becdf..b1fbb10 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationTasksStorage.java
@@ -69,7 +69,8 @@ public class ReplicationTasksStorage {
public String persist(ReplicateRefUpdate r) {
String json = GSON.toJson(r) + "\n";
- String eventKey = sha1(json).name();
+ String key = r.project + "\n" + r.ref + "\n" + r.uri + "\n" + r.remote;
+ String eventKey = sha1(key).name();
Path file = refUpdates().resolve(eventKey);
if (Files.exists(file)) {
@@ -91,8 +92,8 @@ public class ReplicationTasksStorage {
}
public void delete(ReplicateRefUpdate r) {
- String taskJson = GSON.toJson(r) + "\n";
- String taskKey = sha1(taskJson).name();
+ String key = r.project + "\n" + r.ref + "\n" + r.uri + "\n" + r.remote;
+ String taskKey = sha1(key).name();
Path file = refUpdates().resolve(taskKey);
if (disableDeleteForTesting) {