Skip to content

Commit

Permalink
fix: division by zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingrim4 committed Aug 29, 2024
1 parent bf8c292 commit 632ccbb
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ public String toString() {
long obfuscationQueueLength = this.obfuscationQueueLength.getAsInt();

double totalCacheRequest = (double) (cacheHitCountMemory + cacheHitCountDisk + cacheMissCount);
double memoryCacheHitRate = (double) cacheHitCountMemory / totalCacheRequest;
double diskCacheHitRate = (double) cacheHitCountDisk / totalCacheRequest;

double memoryCacheHitRate = 0.0d;
double diskCacheHitRate = 0.0d;
if (totalCacheRequest > 0) {
memoryCacheHitRate = (double) cacheHitCountMemory / totalCacheRequest;
diskCacheHitRate = (double) cacheHitCountDisk / totalCacheRequest;
}

StringBuilder builder = new StringBuilder("Here are some useful statistics:\n");

Expand Down

0 comments on commit 632ccbb

Please sign in to comment.