Skip to content

Commit 31f8523

Browse files
Bouncheckavelanarius
authored andcommitted
Fix SingleConnectionPoolTest.should_throttle_requests()
Adjusts max in-flight requests based on number of connections to shards. With the config that sets 1 connection per host but with 2 shards on that host, there will be 2 connections. This results in twice as many in-flight requests.
1 parent c19db1b commit 31f8523

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

driver-core/src/test/java/com/datastax/driver/core/SingleConnectionPoolTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ public class SingleConnectionPoolTest extends CCMTestsSupport {
3030
@Test(groups = "short")
3131
public void should_throttle_requests() {
3232
// Throttle to a very low value. Even a single thread can generate a higher throughput.
33-
final int maxRequests = 10;
33+
final int maxRequestsPerConnection = 10;
3434
cluster()
3535
.getConfiguration()
3636
.getPoolingOptions()
37-
.setMaxRequestsPerConnection(HostDistance.LOCAL, maxRequests);
37+
.setMaxRequestsPerConnection(HostDistance.LOCAL, maxRequestsPerConnection);
38+
final int maxRequests = 10 * TestUtils.numberOfLocalCoreConnectionsSharded(cluster());
3839

3940
// Track in flight requests in a dedicated thread every second
4041
final AtomicBoolean excessInflightQueriesSpotted = new AtomicBoolean(false);

0 commit comments

Comments
 (0)