gomodule / redigo

Go client for Redis
Apache License 2.0
9.76k stars 1.25k forks source link

Wait pool timeout? #646

Closed nicklaros closed 1 year ago

nicklaros commented 1 year ago

When Wait configuration on pool is set to true, is there any timeout for getting a connection from pool? or will it block until the app succesfully get available connection?

mna commented 1 year ago

By default it would block indefinitely if you use Pool.Get(), but you can use Pool.GetContext and provide a context with a timeout so that it fails if it waits for longer than the timeout: https://pkg.go.dev/github.com/gomodule/redigo/redis#Pool.GetContext

stevenh commented 1 year ago

@mna is correct, Pool.Get() will block until a connection is available.

To clarify the use of issues is for bugs in the code, not for general usage support please use tools like stackoverflow for that.