Skip to content

Commit

Permalink
Speedup GlobalHitsThresholdChecker a little (#13836)
Browse files Browse the repository at this point in the history
Even though this field is not `volatile`, writing it isn't free and
causes needless cache thrashing at some frequency. We can speed things
up by only writing the `true` value and never the `false` value.
  • Loading branch information
original-brownbear authored Oct 1, 2024
1 parent 94d3504 commit 15168ce
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ boolean isThresholdReached() {
if (thresholdReached) {
return true;
}
return thresholdReached = globalHitCount.longValue() > getHitsThreshold();
if (globalHitCount.longValue() > getHitsThreshold()) {
thresholdReached = true;
return true;
}
return false;
}

@Override
Expand Down

0 comments on commit 15168ce

Please sign in to comment.