File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/main/java/org/typesense/api Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ boolean isDueForHealthCheck(Node node) {
5858 return Duration .between (node .lastAccessTimestamp , LocalDateTime .now ()).getSeconds () > configuration .healthCheckInterval .getSeconds ();
5959 }
6060
61- //Loops in a round-robin fashion to check for a healthy node and returns it
61+ // Loops in a round-robin fashion to check for a healthy node and returns it
6262 Node getNode () {
6363 if (configuration .nearestNode != null ) {
6464 if (isDueForHealthCheck ((configuration .nearestNode )) || configuration .nearestNode .isHealthy ) {
@@ -70,14 +70,14 @@ Node getNode() {
7070 Node testNode ;
7171
7272 while (i < configuration .nodes .size ()) {
73+ nodeIndex = (nodeIndex + 1 ) % configuration .nodes .size ();
7374 testNode = configuration .nodes .get (nodeIndex );
7475
7576 if (testNode .isHealthy || isDueForHealthCheck ((testNode ))) {
7677 return testNode ;
7778 }
7879
7980 i += 1 ;
80- nodeIndex = (nodeIndex + 1 ) % configuration .nodes .size ();
8181 }
8282
8383 return configuration .nodes .get (nodeIndex );
You can’t perform that action at this time.
0 commit comments