Remove replication event from pending when runway is allowed Consider a replication event not pending anymore *only if* the runway is free and allowed to run. Removing it too early would result in a ghost event which isn't officially pending but that will be eventually run when rescheduled. Change-Id: Ib0ffa3bec7a6d5d5be56e78a677e8b2133f91e18
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java index 40f9900..9aab0f6 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -465,11 +465,11 @@ if (op.wasCanceled()) { return RunwayStatus.canceled(); } - pending.remove(op.getURI()); PushOne inFlightOp = inFlight.get(op.getURI()); if (inFlightOp != null) { return RunwayStatus.denied(inFlightOp.getId()); } + pending.remove(op.getURI()); inFlight.put(op.getURI(), op); } return RunwayStatus.allowed();