Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.ratis.util.TimeDuration;

import java.net.InetSocketAddress;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -67,6 +68,12 @@ public static RaftClient createClient(RaftGroup raftGroup) {
RaftProperties properties = new RaftProperties();
RaftClientConfigKeys.Rpc.setRequestTimeout(properties,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AngersZhuuuu , thanks for working on this! This is a good change. We should check if the requestTimeout is already set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check if the requestTimeout is already set.

How about the current change? Properties in System should have higher priority. It can cover the requestTimeout if we set it passed by -D

TimeDuration.valueOf(15, TimeUnit.SECONDS));

// Since ratis-shell support GENERIC_COMMAND_OPTIONS, here we should
// merge these options to raft properties to make it work.
final Properties sys = System.getProperties();
sys.stringPropertyNames().forEach(key -> properties.set(key, sys.getProperty(key)));

ExponentialBackoffRetry retryPolicy = ExponentialBackoffRetry.newBuilder()
.setBaseSleepTime(TimeDuration.valueOf(1000, TimeUnit.MILLISECONDS))
.setMaxAttempts(10)
Expand Down