\n | func dial(dst string, opt *ClientOption) (conn net.Conn, err error) { | \n
dial
function to make it accept a context and use Dialer.DialContext
to make a connection, and then we also need to update all the intermediate code paths that use the dial
function under the hood.\nBefore that, you can set connection timeout at ClientOption.Dialer.Timeout
:
\tclient, err := rueidis.NewClient(rueidis.ClientOption{\n\t\tDialer: net.Dialer{\n\t\t\tTimeout: 30 * time.Millisecond,\n\t\t},\n\t\tBlockingPoolSize: 1024,\n\t})
Also note that you should make sure you never hit the BlockingPoolSize
because once the pool is full it also gets stuck if no free connections.
-
I'm using the recent version 1.0.55, disable autopipeling (with some specific type of commands designated to pipe). |
Beta Was this translation helpful? Give feedback.
-
Hi @liuzhaohui, Yes, currently acquiring a connection doesn't respect the context deadline. To respect it, we need to update: Line 467 in f56a674 the dial function to make it accept a context and use Dialer.DialContext to make a connection, and then we also need to update all the intermediate code paths that use the dial function under the hood.
Before that, you can set connection timeout at client, err := rueidis.NewClient(rueidis.ClientOption{
Dialer: net.Dialer{
Timeout: 30 * time.Millisecond,
},
BlockingPoolSize: 1024,
}) Also note that you should make sure you never hit the |
Beta Was this translation helpful? Give feedback.
Hi @liuzhaohui,
Yes, currently acquiring a connection doesn't respect the context deadline. To respect it, we need to update:
rueidis/rueidis.go
Line 467 in f56a674
the
dial
function to make it accept a context and useDialer.DialContext
to make a connection, and then we also need to update all the intermediate code paths that use thedial
function under the hood.Before that, you can set connection timeout at
ClientOption.Dialer.Timeout
:Also note that you…