Align default values for Cassandra's throttling properties
Closes gh-25149
This commit is contained in:
@@ -356,24 +356,24 @@ public class CassandraProperties {
|
||||
* Maximum number of requests that can be enqueued when the throttling threshold
|
||||
* is exceeded.
|
||||
*/
|
||||
private int maxQueueSize = 10000;
|
||||
private int maxQueueSize;
|
||||
|
||||
/**
|
||||
* Maximum number of requests that are allowed to execute in parallel.
|
||||
*/
|
||||
private int maxConcurrentRequests = 10000;
|
||||
private int maxConcurrentRequests;
|
||||
|
||||
/**
|
||||
* Maximum allowed request rate.
|
||||
*/
|
||||
private int maxRequestsPerSecond = 10000;
|
||||
private int maxRequestsPerSecond;
|
||||
|
||||
/**
|
||||
* How often the throttler attempts to dequeue requests. Set this high enough that
|
||||
* each attempt will process multiple entries in the queue, but not delay requests
|
||||
* too much.
|
||||
*/
|
||||
private Duration drainInterval = Duration.ofMillis(10);
|
||||
private Duration drainInterval;
|
||||
|
||||
public ThrottlerType getType() {
|
||||
return this.type;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.autoconfigure.cassandra;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlIdentifier;
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
|
||||
import com.datastax.oss.driver.api.core.config.DefaultDriverOption;
|
||||
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
|
||||
@@ -32,6 +33,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
/**
|
||||
* Tests for {@link CassandraAutoConfiguration}
|
||||
@@ -186,6 +188,14 @@ class CassandraAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void driverConfigLoaderWithRateLimitingRequiresExtraConfiguration() {
|
||||
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=rate-limiting")
|
||||
.run((context) -> assertThatThrownBy(() -> context.getBean(CqlSession.class))
|
||||
.hasMessageContaining("Error instantiating class RateLimitingRequestThrottler")
|
||||
.hasMessageContaining("No configuration setting found for key"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void driverConfigLoaderCustomizeConcurrencyLimitingRequestThrottler() {
|
||||
this.contextRunner.withPropertyValues("spring.data.cassandra.request.throttler.type=concurrency-limiting",
|
||||
|
||||
Reference in New Issue
Block a user