-
Notifications
You must be signed in to change notification settings - Fork 241
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
Goworker does not recover from loss of connection to redis #15
Comments
I modified func GetConn() (*RedisConn, error) {
resource, err := pool.Get()
if err != nil {
return nil, err
}
+
+ // Performs simple connection check. Redial if needed
+ _, err = resource.(*RedisConn).Do("PING")
+ if err != nil {
+ resource.(*RedisConn).Close()
+ resource, err = redisConnFromUri(uri)
+ if err != nil {
+ return nil, err
+ }
+ }
+
return resource.(*RedisConn), nil
} Not sure if this is recommended way when working with vitess' pools. I can make a PR if this changes are OK :) |
I know this is an old thread but maybe this will help someone like me who found it when trying to handle disconnects. |
The main issue is that on the The only way I can think of having an error be returned as everything is running in goroutines and the main waitCh := make(chan struct{})
go func() {
monitor.Wait()
close(waitCh)
}()
select {
case <-waitCh:
case err := <-poller.error:
// quite to gracefully shut down
quit <- true
// Return the poller error
return err
} All the possible errors from the workers are also related to Redis and and they'll be closed using the Would this be ok to open a PR for? |
If the connection to redis goes down (due to redis restart, netsplit, ...) the library does
not recover, but only logs the error:
Goworker should recognize the redis client instance is dead and try reconnecting.
The text was updated successfully, but these errors were encountered: