diff options
-rw-r--r-- | src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java | 13 | ||||
-rw-r--r-- | src/main/resources/Documentation/config.md | 10 |
2 files changed, 16 insertions, 7 deletions
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 a175285..eea1038 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java @@ -28,6 +28,7 @@ import com.google.gerrit.server.PluginUser; import com.google.gerrit.server.account.GroupBackend; import com.google.gerrit.server.account.GroupBackends; import com.google.gerrit.server.account.ListGroupMembership; +import com.google.gerrit.server.config.ConfigUtil; import com.google.gerrit.server.config.FactoryModule; import com.google.gerrit.server.config.RequestScopedReviewDbProvider; import com.google.gerrit.server.git.GitRepositoryManager; @@ -103,8 +104,10 @@ class Destination { final GroupBackend groupBackend) { remote = rc; gitManager = gitRepositoryManager; - delay = Math.max(0, getInt(rc, cfg, "replicationdelay", 15)); - retryDelay = Math.max(0, getInt(rc, cfg, "replicationretry", 1)); + delay = Math.max(0, + getTimeUnit(rc, cfg, "replicationdelay", 15, TimeUnit.SECONDS)); + retryDelay = Math.max(0, + getTimeUnit(rc, cfg, "replicationretry", 1, TimeUnit.MINUTES)); lockErrorMaxRetries = cfg.getInt("replication", "lockErrorMaxRetries", 0); adminUrls = cfg.getStringList("remote", rc.getName(), "adminUrl"); @@ -199,6 +202,12 @@ class Destination { return cfg.getInt("remote", rc.getName(), name, defValue); } + private static int getTimeUnit( + RemoteConfig rc, Config cfg, String name, int defValue, TimeUnit unit) { + return (int)ConfigUtil.getTimeUnit( + cfg, "remote", rc.getName(), name, defValue, unit); + } + private boolean isVisible(final Project.NameKey project, ReplicationState... states) { try { diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md index 29626d8..54251ce 100644 --- a/src/main/resources/Documentation/config.md +++ b/src/main/resources/Documentation/config.md @@ -183,17 +183,17 @@ remote.NAME.push [2]: #example_file remote.NAME.replicationDelay -: Number of seconds to wait before scheduling a remote push - operation. Setting the delay to 0 effectively disables the - delay, causing the push to start as soon as possible. +: Time to wait before scheduling a remote push operation. Setting + the delay to 0 effectively disables the delay, causing the push + to start as soon as possible. This is a Gerrit specific extension to the Git remote block. By default, 15 seconds. remote.NAME.replicationRetry -: Number of minutes to wait before scheduling a remote push - operation previously failed due to an offline remote server. +: Time to wait before scheduling a remote push operation previously + failed due to an offline remote server. If a remote push operation fails because a remote server was offline, all push operations to the same destination URL are |