Speedup GlobalHitsThresholdChecker a little (#13836)

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.
This commit is contained in:
Armin Braun 2024-10-01 04:13:36 +02:00 committed by GitHub
parent 94d3504359
commit 15168ce5c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -46,7 +46,11 @@ abstract class HitsThresholdChecker {
if (thresholdReached) {
return true;
}
return thresholdReached = globalHitCount.longValue() > getHitsThreshold();
if (globalHitCount.longValue() > getHitsThreshold()) {
thresholdReached = true;
return true;
}
return false;
}
@Override