1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Better rate limited message.

This commit is contained in:
Vladimir Mihailenco
2015-12-22 15:45:03 +02:00
parent f6d6826d82
commit d7c44c7899
7 changed files with 69 additions and 37 deletions

View File

@ -233,9 +233,9 @@ func (c *PubSub) Receive() (interface{}, error) {
return c.ReceiveTimeout(0)
}
func (c *PubSub) reconnect() {
func (c *PubSub) reconnect(reason error) {
// Close current connection.
c.connPool.(*stickyConnPool).Reset()
c.connPool.(*stickyConnPool).Reset(reason)
if len(c.channels) > 0 {
if err := c.Subscribe(c.channels...); err != nil {
@ -276,7 +276,7 @@ func (c *PubSub) ReceiveMessage() (*Message, error) {
if errNum > 2 {
time.Sleep(time.Second)
}
c.reconnect()
c.reconnect(err)
continue
}