I'm using redigo for both regular commands as well as subscribing. Every few days I get this error which causes a panic.
dial tcp IP:6379: connect: connection timed out
I'm guessing there is a some lag or minor disturbance with the network which is causing the connection to time out.
How can I avoid this? I'm OK with the program waiting a few seconds until the problem is resolves, rather than panicking.
How can I avoid this? Should I define Timeouts for Dial? Such as
DialReadTimeout
DialWriteTimeout
Use DialConnectTimeout to specify a timeout for dialing a network connection or DialNetDial for complete control over dialing a network connection.
The application supplied NetDial function can set timeouts, throttle connect attempts on failure, and more.
Panics related to a dial failure are probably due to a lack of error checking in the application.
DialWriteTimeout and DialReadTimeout are dial options for specifying the timeout when writing a command to the network connection and reading a reply from the network connection respectively. These options have no bearing on timeouts during connect.