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

Faster and simpler pool.

This commit is contained in:
Vladimir Mihailenco
2016-03-17 18:00:47 +02:00
parent 93a7fe0de3
commit 6e1aef39ea
22 changed files with 418 additions and 492 deletions

View File

@ -8,6 +8,8 @@ import (
"gopkg.in/redis.v3/internal/pool"
)
var receiveMessageTimeout = 5 * time.Second
// Posts a message to the given channel.
func (c *Client) Publish(channel, message string) *IntCmd {
req := NewIntCmd("PUBLISH", channel, message)
@ -255,7 +257,7 @@ func (c *PubSub) Receive() (interface{}, error) {
func (c *PubSub) ReceiveMessage() (*Message, error) {
var errNum uint
for {
msgi, err := c.ReceiveTimeout(5 * time.Second)
msgi, err := c.ReceiveTimeout(receiveMessageTimeout)
if err != nil {
if !isNetworkError(err) {
return nil, err