Skip to content

Commit 0178fe2

Browse files
committed
fix timeout format issue
1 parent c51ab13 commit 0178fe2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/net/consensys/fleet/common/rpc/client/WebClientWrapper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.util.List;
2222
import java.util.concurrent.CompletableFuture;
23+
import java.util.concurrent.TimeUnit;
2324

2425
import com.fasterxml.jackson.core.JsonProcessingException;
2526
import io.vertx.core.Vertx;
@@ -39,15 +40,15 @@ public class WebClientWrapper {
3940
private final WebClient webClient;
4041
private final ConvertMapperProvider convertMapperProvider;
4142
private final PeerNodesManager peerManagers;
42-
private final long timeout;
43+
private final long timeoutInMillisecond;
4344

4445
public WebClientWrapper(
4546
final ConvertMapperProvider convertMapperProvider,
4647
final PeerNodesManager peerManagers,
47-
final long timeout) {
48+
final long timeoutInMillisecond) {
4849
this.peerManagers = peerManagers;
4950
this.convertMapperProvider = convertMapperProvider;
50-
this.timeout = timeout;
51+
this.timeoutInMillisecond = TimeUnit.SECONDS.toMillis(timeoutInMillisecond);
5152
this.webClient = WebClient.create(Vertx.vertx(), new WebClientOptions());
5253
}
5354

@@ -68,7 +69,7 @@ public CompletableFuture<HttpResponse<Buffer>> sendToLeader(
6869

6970
webClient
7071
.post(leader.port(), leader.host(), endpoint)
71-
.timeout(timeout)
72+
.timeout(timeoutInMillisecond)
7273
.putHeader("Content-Type", CONTENT_TYPE)
7374
.sendJsonObject(
7475
jsonObject,
@@ -103,7 +104,7 @@ public void sendToFollowers(final String endpoint, final String methodName, fina
103104
peerNode -> {
104105
webClient
105106
.post(peerNode.port(), peerNode.host(), endpoint)
106-
.timeout(timeout)
107+
.timeout(timeoutInMillisecond)
107108
.putHeader("Content-Type", CONTENT_TYPE)
108109
.sendJsonObject(
109110
jsonObject,

0 commit comments

Comments
 (0)