diff options
author | Andrew Steinborn <git@steinborn.me> | 2021-01-17 14:43:23 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-17 19:43:23 +0000 |
commit | b2a4b74f9e70eb3209ad0f736052ea02c113fcad (patch) | |
tree | fdc25d531ff88e4b2af2a325ec1c835854eefe27 /spark-common/src/main/java | |
parent | 3b19f5283cc42171c99dd5d47a8b3254a16e67de (diff) | |
download | spark-b2a4b74f9e70eb3209ad0f736052ea02c113fcad.tar.gz spark-b2a4b74f9e70eb3209ad0f736052ea02c113fcad.tar.bz2 spark-b2a4b74f9e70eb3209ad0f736052ea02c113fcad.zip |
Fix a bug upon early server startup in which percentiles would throw an out of bounds exception (#92)
Diffstat (limited to 'spark-common/src/main/java')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java b/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java index 1e5e8b2..aa56f26 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java +++ b/spark-common/src/main/java/me/lucko/spark/common/util/RollingAverage.java @@ -99,7 +99,7 @@ public class RollingAverage { } sortedSamples.sort(null); - int rank = (int) Math.ceil((percentile / 100d) * sortedSamples.size()); + int rank = (int) Math.ceil((percentile / 100d) * (sortedSamples.size() - 1)); return sortedSamples.get(rank).doubleValue(); } |