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

ConnectionStringBuilder.ToString() 总会额外输出两个参数 #208

Open
VicBilibily opened this issue Sep 19, 2024 · 4 comments
Open

Comments

@VicBilibily
Copy link

VicBilibily commented Sep 19, 2024

https://github.com/2881099/FreeRedis/blame/e5c0bf7e57b844cd7feab269de829a38c12f933a/src/FreeRedis/ConnectionStringBuilder.cs#L60-L61

这两行判断的值和初始化时的默认值不一样,生成的连接字符串总会输出这两个参数

@2881099
Copy link
Owner

2881099 commented Sep 19, 2024

哪两个参数

@VicBilibily
Copy link
Author

ReceiveTimeoutSendTimeout 这两个参数的默认值和输出判断值不一致,ToString()时总会输出connect timeout=20,receive timeout=20
复用连接字符串到其他 Redis 实现时报错发现的

public TimeSpan ReceiveTimeout { get; set; } = TimeSpan.FromSeconds(20);
public TimeSpan SendTimeout { get; set; } = TimeSpan.FromSeconds(20);

if (ReceiveTimeout != TimeSpan.FromSeconds(10)) sb.Append(",receive timeout=").Append((long)ReceiveTimeout.TotalMilliseconds);
if (SendTimeout != TimeSpan.FromSeconds(10)) sb.Append(",send timeout=").Append((long)SendTimeout.TotalMilliseconds);

@2881099
Copy link
Owner

2881099 commented Dec 24, 2024

你看下面 Parse 和这个对应的

@VicBilibily
Copy link
Author

你看下面 Parse 和这个对应的

Parse 只做参数解析,并没有做默认值的判断

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants