Skip to content

Commit e57621c

Browse files
committed
improves WeightedStats API
Signed-off-by: Oleh Dokuka <[email protected]>
1 parent 8a41b41 commit e57621c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

rsocket-core/src/main/java/io/rsocket/loadbalance/BaseWeightedStats.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public int pending() {
8181
}
8282

8383
@Override
84-
public double availability() {
84+
public double weightedAvailability() {
8585
if (Clock.now() - stamp > tau) {
8686
updateAvailability(1.0);
8787
}

rsocket-core/src/main/java/io/rsocket/loadbalance/WeightedLoadbalanceStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private static double algorithmicWeight(
159159
latency *= calculateFactor(latency, high, bandWidth);
160160
}
161161

162-
return (rSocket.availability() * weightedStats.availability())
162+
return (rSocket.availability() * weightedStats.weightedAvailability())
163163
/ (1.0d + latency * (pending + 1));
164164
}
165165

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package io.rsocket.loadbalance;
22

3-
import io.rsocket.Availability;
4-
53
/**
64
* Representation of stats used by the {@link WeightedLoadbalanceStrategy}
75
*
86
* @since 1.1
97
*/
10-
public interface WeightedStats extends Availability {
8+
public interface WeightedStats {
119

1210
double higherQuantileLatency();
1311

@@ -16,4 +14,6 @@ public interface WeightedStats extends Availability {
1614
int pending();
1715

1816
double predictedLatency();
17+
18+
double weightedAvailability();
1919
}

0 commit comments

Comments
 (0)