Skip to content

Commit 4938439

Browse files
committed
Addressing Claude-Code review feedback
1 parent 6afa1a8 commit 4938439

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

driver-core/src/main/com/mongodb/internal/connection/BackpressureErrorLabeler.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.mongodb.internal.connection;
1818

1919
import com.mongodb.MongoException;
20-
import com.mongodb.MongoSecurityException;
2120
import com.mongodb.MongoSocketException;
2221

2322
import javax.net.ssl.SSLHandshakeException;
@@ -43,12 +42,6 @@ private BackpressureErrorLabeler() {
4342
}
4443

4544
static void applyLabelsIfEligible(final Throwable t) {
46-
if (!(t instanceof MongoException)) {
47-
return;
48-
}
49-
if (t instanceof MongoSecurityException) {
50-
return;
51-
}
5245
if (!(t instanceof MongoSocketException)) {
5346
return;
5447
}
@@ -66,7 +59,7 @@ static void applyLabelsIfEligible(final Throwable t) {
6659
mongoException.addLabel(MongoException.RETRYABLE_ERROR_LABEL);
6760
}
6861

69-
static boolean isDnsLookupFailure(final Throwable t) {
62+
private static boolean isDnsLookupFailure(final Throwable t) {
7063
Throwable cause = t.getCause();
7164
while (cause != null) {
7265
if (cause instanceof UnknownHostException) {
@@ -77,10 +70,7 @@ static boolean isDnsLookupFailure(final Throwable t) {
7770
return false;
7871
}
7972

80-
static boolean isTlsConfigurationError(final Throwable t) {
81-
if (!(t instanceof MongoSocketException)) {
82-
return false;
83-
}
73+
private static boolean isTlsConfigurationError(final Throwable t) {
8474
Throwable cause = t.getCause();
8575
while (cause != null) {
8676
if (cause instanceof CertificateException

driver-core/src/test/unit/com/mongodb/internal/connection/DefaultServerSpecification.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class DefaultServerSpecification extends Specification {
259259
]
260260
}
261261

262-
def 'DNS lookup failure should invalidate the pool'() {
262+
def 'DNS lookup failure should not be labeled as backpressure and should invalidate the pool'() {
263263
given:
264264
def exceptionToThrow = new MongoSocketException('DNS lookup failed', new ServerAddress(),
265265
new UnknownHostException('no such host'))

driver-sync/src/test/functional/com/mongodb/client/ServerDiscoveryAndMonitoringProseTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ public void testConnectionPoolBackpressure() throws InterruptedException {
327327
failedCheckOutCount >= 10);
328328
assertEquals(0, connectionPoolListener.countEvents(ConnectionPoolClearedEvent.class));
329329
} finally {
330-
Thread.sleep(1000);
330+
try {
331+
Thread.sleep(1000);
332+
} catch (InterruptedException e) {
333+
Thread.currentThread().interrupt();
334+
}
331335
adminDatabase.runCommand(new Document("setParameter", 1)
332336
.append("ingressConnectionEstablishmentRateLimiterEnabled", false));
333337
}

0 commit comments

Comments
 (0)