Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initQueryTimeout and ildeTimeout defaults are not aligned with Cassandra defaults #25150

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -270,7 +270,7 @@ public static class Connection {
* Timeout to use for internal queries that run as part of the initialization
* process, just after a connection is opened.
*/
private Duration initQueryTimeout = Duration.ofMillis(500);
private Duration initQueryTimeout = Duration.ofSeconds(5);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


public Duration getConnectTimeout() {
return this.connectTimeout;
Expand Down Expand Up @@ -360,7 +360,7 @@ public static class Pool {
/**
* Idle timeout before an idle connection is removed.
*/
private Duration idleTimeout = Duration.ofSeconds(120);
private Duration idleTimeout = Duration.ofSeconds(5);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


/**
* Heartbeat interval after which a message is sent on an idle connection to make
Expand Down
@@ -0,0 +1,43 @@
package org.springframework.boot.autoconfigure.cassandra;

import com.datastax.oss.driver.api.core.config.OptionsMap;
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Tests for {@link CassandraProperties}.
*
* @author Chris Bono
*/
class CassandraPropertiesTest {

@Test
void defaultValuesAreConsistent() {
CassandraProperties properties = new CassandraProperties();
OptionsMap optionsMap = OptionsMap.driverDefaults();

assertThat(properties.getConnection().getConnectTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT));

assertThat(properties.getConnection().getInitQueryTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT));

assertThat(properties.getRequest().getTimeout()).isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_TIMEOUT));

assertThat(properties.getRequest().getPageSize())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_PAGE_SIZE));

assertThat(properties.getRequest().getThrottler().getType().type())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));

assertThat(properties.getPool().getHeartbeatInterval())
.isEqualTo(optionsMap.get(TypedDriverOption.HEARTBEAT_INTERVAL));

assertThat(properties.getPool().getIdleTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.HEARTBEAT_TIMEOUT));

}

}