Skip to content

Commit 808fa66

Browse files
committed
docs(gax-grpc): explain resizing detection choice in comments
1 parent 029dba5 commit 808fa66

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc

sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ChannelPool.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ void resize() {
321321
dampenedTarget = currentSize + (int) Math.copySign(settings.getMaxResizeDelta(), delta);
322322
}
323323

324+
// We only count as "resized" if the thresholds are crossed and we actually attempt to scale.
325+
// Checking (dampenedTarget != currentSize) would cause false positives when the pool is within
326+
// bounds but not at the target, because the target aims for the middle of the bounds.
324327
boolean resized = (localEntries.size() < minChannels || localEntries.size() > maxChannels);
325328
if (resized) {
326329
consecutiveResizes++;

0 commit comments

Comments
 (0)