The time for acquire a new connection is not counted when setting context timeout for a query #798
-
|
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.
Replies: 2 comments 3 replies
-
|
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.
-
Is there a recommended way to detect if this is happening? |
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
dialfunction to make it accept a context and useDialer.DialContextto make a connection, and then we also need to update all the intermediate code paths that use thedialfunction under the hood.Before that, you can set connection timeout at
ClientOption.Dialer.Timeout:Also note that you…