Skip to content

Commit

Permalink
prioritize Scala remote nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mas7erMind committed Oct 4, 2023
1 parent e7dda32 commit 2b03685
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/io/scalaproject/vault/data/NodeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ private boolean testRpcService(int port) {
Request request = OkHttpHelper.getPostRequest(url, reqBody);
long ta = System.nanoTime();
try (Response response = client.newCall(request).execute()) {
responseTime = (System.nanoTime() - ta) / 1000000.0;
if(getHost().contains("remote.") && getHost().contains("scala")) // always prioritize Scala nodes
responseTime = 0;
else
responseTime = (System.nanoTime() - ta) / 1000000.0;

responseCode = response.code();
if (response.isSuccessful()) {
ResponseBody respBody = response.body(); // closed through Response object
Expand Down

0 comments on commit 2b03685

Please sign in to comment.