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

feat: refactor redispool #408

Merged

Conversation

daheige
Copy link
Member

@daheige daheige commented Jun 4, 2022

Please provide issue(s) of this PR:
refactor #
refactor common/redispool
for #404
for #403
for #398

@andrewshan
Copy link
Member

@magederek, it may be conflicted with your pr, pls check it #405

@magederek
Copy link
Contributor

magederek commented Jun 5, 2022

Good style for options! As my opinion, not all the options from goredis should be revealed such as tls.Config.
Please also update the test files, yaml configs and helm charts for a full configuration change.

@magederek, it may be conflicted with your pr, pls check it #405

#403 and #405 are giving some moderate modification for #398 and #404. Refactor of redispool options's code should be an independent issue to discuss and enhance, which can be merge later.

}

// DefaultConfig redis pool configuration with default values
func DefaultConfig() *Config {
return &Config{
MaxIdle: 200,
IdleTimeout: commontime.Duration(120 * time.Second),
ConnectTimeout: commontime.Duration(300 * time.Millisecond),
Copy link
Member

Choose a reason for hiding this comment

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

默认连接时长和消息超时为什么要改成5s?

Copy link
Member

Choose a reason for hiding this comment

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

默认值和心跳场景有关系,都恢复成300ms吧

// WithConfig set new config for NewPool,keep old code compatibility
func WithConfig(newConfig *Config) Option {
return func(c *Config) {
c = newConfig
Copy link
Member

Choose a reason for hiding this comment

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

这个逻辑,应该是问题的?并不能真正影响c的实际内容吧

Copy link
Member

Choose a reason for hiding this comment

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

你的写成 *c = *newConfig 才可以吧

WithTLS bool `json:"withTLS"`

// TLS Config to use. When set TLS will be negotiated.
TlsConfig *tls.Config
Copy link
Contributor

@magederek magederek Jun 5, 2022

Choose a reason for hiding this comment

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

both tlsConfig itself and fields in tls.Config have not json tag for unmarshalling from JSON config. Currently, only MinVersion field is useful for most of the user, I think we could hide the details of tls config.

@daheige
Copy link
Member Author

daheige commented Jun 5, 2022 via email

@daheige
Copy link
Member Author

daheige commented Jun 5, 2022 via email

@daheige
Copy link
Member Author

daheige commented Jun 5, 2022 via email

@andrewshan andrewshan added the need discuss Need to discuss label Jun 6, 2022
@daheige
Copy link
Member Author

daheige commented Jun 6, 2022 via email

@shichaoyuan
Copy link
Member

whether there is a need to add certificate configuration?

@andrewshan
Copy link
Member

@daheige hello, pls help to resolve the confilcts

@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2022

Codecov Report

Merging #408 (76fc524) into main (c02030d) will decrease coverage by 0.15%.
The diff coverage is 22.54%.

@@            Coverage Diff             @@
##             main     #408      +/-   ##
==========================================
- Coverage   21.58%   21.42%   -0.16%     
==========================================
  Files         180      182       +2     
  Lines       24588    24934     +346     
==========================================
+ Hits         5307     5343      +36     
- Misses      18471    18779     +308     
- Partials      810      812       +2     
Impacted Files Coverage Δ
common/redispool/config_option.go 4.76% <4.76%> (ø)
common/redispool/redis_pool.go 13.78% <51.28%> (ø)
service/batch/instance.go 38.32% <0.00%> (-2.65%) ⬇️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@chuntaojun chuntaojun merged commit de6fdb2 into polarismesh:main Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need discuss Need to discuss
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants