Merge "Add integration test for new project creation" into stable-3.6
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/OnStartStop.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/OnStartStop.java
index 5cf8bb6..8dacc9a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/OnStartStop.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/OnStartStop.java
@@ -20,6 +20,7 @@
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.extensions.systemstatus.ServerInformation;
+import com.google.gerrit.server.config.GerritIsReplica;
import com.google.gerrit.server.events.EventDispatcher;
import com.google.gerrit.server.git.WorkQueue;
import com.google.inject.Inject;
@@ -38,6 +39,7 @@
private final ReplicationState.Factory replicationStateFactory;
private final SourcesCollection sourcesCollection;
private final WorkQueue workQueue;
+ private boolean isReplica;
@Inject
protected OnStartStop(
@@ -47,7 +49,8 @@
DynamicItem<EventDispatcher> eventDispatcher,
ReplicationState.Factory replicationStateFactory,
SourcesCollection sourcesCollection,
- WorkQueue workQueue) {
+ WorkQueue workQueue,
+ @GerritIsReplica Boolean isReplica) {
this.srvInfo = srvInfo;
this.fetchAll = fetchAll;
this.config = config;
@@ -56,11 +59,13 @@
this.fetchAllFuture = Atomics.newReference();
this.sourcesCollection = sourcesCollection;
this.workQueue = workQueue;
+ this.isReplica = isReplica;
}
@Override
public void start() {
- if (srvInfo.getState() == ServerInformation.State.STARTUP
+ if (isReplica
+ && srvInfo.getState() == ServerInformation.State.STARTUP
&& config.isReplicateAllOnPluginStart()) {
ReplicationState state =
replicationStateFactory.create(