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

Assertion does not match its error message and comments for QueryOptions.readTimeout method #1494

Closed
seungh0 opened this issue Jun 12, 2024 · 1 comment
Labels
type: bug A general bug

Comments

@seungh0
Copy link
Contributor

seungh0 commented Jun 12, 2024

Hi there,
I noticed a discrepancy between the comments and error messages in the QueryOptions.ReadTimeout method and the actual behavior of the code.
I suggest allowing the code to accept 0 without raising an exception to handle disabling the timeout.

/**
* Sets the request timeout. Overrides the default timeout.
*
* @param timeout the read timeout. Negative values are not allowed. If it is {@code 0}, the read timeout will be
* disabled for this statement.
* @return {@code this} {@link QueryOptionsBuilder}
* @see com.datastax.oss.driver.api.core.cql.SimpleStatement#setTimeout(Duration)
* @since 3.0
*/
public QueryOptionsBuilder timeout(Duration timeout) {
Assert.isTrue(!timeout.isZero() && !timeout.isNegative(), "ReadTimeout must be greater than equal to zero");
this.timeout = timeout;
return this;
}

I've also submitted a PR to address this. I would appreciate it if you could review it.

Thank you.

seungh0 pushed a commit to seungh0/spring-data-cassandra that referenced this issue Jun 12, 2024
If it is zero, the read timeout will be disabled for this statement

Closes spring-projects#1494
seungh0 added a commit to seungh0/spring-data-cassandra that referenced this issue Jun 12, 2024
If it is zero, the read timeout will be disabled for this statement

Closes spring-projects#1494
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 12, 2024
seungh0 added a commit to seungh0/spring-data-cassandra that referenced this issue Jun 12, 2024
If it is zero, the read timeout will be disabled for this statement.

Closes spring-projects#1494
@mp911de
Copy link
Member

mp911de commented Jun 12, 2024

Good catch, I think we might have more places like that one. I'm going to have a look during the merge.

@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 12, 2024
mp911de pushed a commit that referenced this issue Jun 12, 2024
If it is zero, the read timeout will be disabled for this statement.

Closes #1494
Original pull request: #1495
mp911de added a commit that referenced this issue Jun 12, 2024
Delegate calls from deprecated methods to their replacement methods. Simplify tests.

See #1494
Original pull request: #1495
mp911de added a commit that referenced this issue Jun 12, 2024
Delegate calls from deprecated methods to their replacement methods. Simplify tests.

See #1494
Original pull request: #1495
mp911de pushed a commit that referenced this issue Jun 12, 2024
If it is zero, the read timeout will be disabled for this statement.

Closes #1494
Original pull request: #1495
mp911de added a commit that referenced this issue Jun 12, 2024
Delegate calls from deprecated methods to their replacement methods. Simplify tests.

See #1494
Original pull request: #1495
@mp911de mp911de added this to the 4.2.7 (2023.1.7) milestone Jun 12, 2024
@mp911de mp911de changed the title Assertion does not match its error message and comments for QueryOptions.ReadTimeout method Assertion does not match its error message and comments for QueryOptions.readTimeout method Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants