feat: Option to disable dial on creating client#584
feat: Option to disable dial on creating client#584SoulPancake wants to merge 7 commits intoredis:mainfrom
Conversation
|
Hi @rueian I decided to begin on this
Thanks in advance. Let me know which direction I can take for this |
If you are asking how to write tests for this behavior, I think passing a custom
I think, yes, returning their concrete structs is enough except for the sentinel client. The sentinel client may need some modifications to support auto-retry. But for all these three cases, the initial |
|
|
||
| _, port, _ := net.SplitHostPort(ln.Addr().String()) | ||
|
|
||
| dialFn := func(addr string, dialer *net.Dialer, tlsConfig *tls.Config) (net.Conn, error) { |
There was a problem hiding this comment.
@rueian Do you think this is how I should do it?
In principle it should work but I am not too sure why it is timing out, maybe I'm missing something
There was a problem hiding this comment.
The dailFn looks good to me but you must invoke client.Do to trigger the dailFn again after the NewClient. Otherwise, the dailFn is only called once.
There was a problem hiding this comment.
I am slightly stuck here
I should client.Do to trigger the dialFn right after the NewClient call? @rueian
There was a problem hiding this comment.
Yes. I believe so. There is no other background goroutine that will dial for a connection.
|
This has been stale because of other work, so I am closing this now, might re-open a different PR rebasing from latest master |
Approach to #489