Skip to content

Allow redis's connect and read/command timeouts to be configured separately #23137

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

Closed
wants to merge 2 commits into from

Conversation

anshlykov
Copy link
Contributor

Fixes #23070

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 29, 2020
@anshlykov anshlykov marked this pull request as ready for review August 29, 2020 21:10
Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Rather than introducing two new properties, let's reuse the existing one for read/command timeout.

Would you have time to review your proposal?

/**
* Read timeout.
*/
private Duration readTimeout;
Copy link
Member

Choose a reason for hiding this comment

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

Rather than adding two now configuration properties, let's reuse the existing timeout for the read timeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -67,10 +67,20 @@
private boolean ssl;

/**
* Connection timeout.
* Connection and read timeout.
*/
private Duration timeout;
Copy link
Member

Choose a reason for hiding this comment

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

As far as I can see timeout is not longer honoured, that's a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used timeout in getters if a more specific property was not set. But now it's not relevant anymore

...
	public Duration getConnectionTimeout() {
 		return (this.connectionTimeout != null) ? this.connectionTimeout : this.timeout;
 	}
...
	public Duration getReadTimeout() {
 		return (this.readTimeout != null) ? this.readTimeout : this.timeout;
 	}
....

});
@ParameterizedTest(name = "{0}")
@MethodSource("timeoutArguments")
void testRedisConfigurationWithTimeout(List<String> properties, long readTimeout, long connectionTimeout) {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than a parametrised test, I think we can go with two tests. One that doesn't set anything and make sure defaults are properly honoured and one that sets both the timeout and the connect timeout and check the override has been customized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

});
@ParameterizedTest(name = "{0}")
@MethodSource("timeoutArguments")
void testRedisConfigurationWithTimeouts(List<String> properties, long readTimeout, long connectionTimeout) {
Copy link
Member

Choose a reason for hiding this comment

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

Same, I don't think a parameterized test is warranted here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Sep 7, 2020
@anshlykov
Copy link
Contributor Author

@snicoll Thanks for your feedback. I'll make the changes today or tomorrow

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 9, 2020
@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Sep 9, 2020
@anshlykov anshlykov requested a review from snicoll September 10, 2020 16:04
@snicoll snicoll self-assigned this Sep 11, 2020
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Sep 11, 2020
@snicoll snicoll added this to the 2.4.0-M3 milestone Sep 11, 2020
@snicoll snicoll closed this in 26daf37 Sep 11, 2020
@snicoll snicoll changed the title Add spring.redis.read-timeout and spring.redis.connection-timeout Allow redis's connect and read/command timeouts to be configured separately Sep 11, 2020
@snicoll
Copy link
Member

snicoll commented Sep 11, 2020

@anshlykov thanks for the follow-up. This is now merged in master with a polish commit.

@anshlykov anshlykov deleted the gh-23070 branch September 11, 2020 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spring.redis.timeout seems to apply inconsistently across its implementations
3 participants