Fix inconsistent logging for scheduled pushes
In cases where the replication start command is triggered with --now,
logs incorrectly show that replication is scheduled with default delay.
This change fixes it.
In cases where a push is consolidated with an existing pending push,
logs are added to specifically mention it.
Change-Id: I296a2ec5772eb60b38dd47502fa3bd5d247d317a
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 12f0273..1febf17 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -429,13 +429,16 @@
ScheduledFuture<?> ignored =
pool.schedule(task, now ? 0 : config.getDelay(), TimeUnit.SECONDS);
pending.put(uri, task);
+ repLog.atInfo().log(
+ "scheduled %s:%s => %s to run %s",
+ project, ref, task, now ? "now" : "after " + config.getDelay() + "s");
} else {
addRef(task, ref);
task.addState(ref, state);
+ repLog.atInfo().log(
+ "consolidated %s:%s => %s with an existing pending push", project, ref, task);
}
state.increasePushTaskCount(project.get(), ref);
- repLog.atInfo().log(
- "scheduled %s:%s => %s to run after %ds", project, ref, task, config.getDelay());
}
}