Code cleanup

This commit is contained in:
Vladimir Mihailenco 2017-03-31 15:11:11 +03:00
parent 18dcec2144
commit ef95182d29
7 changed files with 3 additions and 33 deletions

View File

@ -338,8 +338,6 @@ type ClusterClient struct {
// Reports where slots reloading is in progress.
reloading uint32
closed bool
}
// NewClusterClient returns a Redis Cluster client as described in

View File

@ -2316,6 +2316,7 @@ var _ = Describe("Commands", func() {
zAdd = client.ZAdd("zset", redis.Z{0, "b"})
Expect(zAdd.Err()).NotTo(HaveOccurred())
zAdd = client.ZAdd("zset", redis.Z{0, "c"})
Expect(zAdd.Err()).NotTo(HaveOccurred())
zRangeByLex := client.ZRangeByLex("zset", redis.ZRangeBy{
Min: "-",

View File

@ -65,7 +65,6 @@ type ConnPool struct {
stats Stats
_closed int32 // atomic
lastErr atomic.Value
}
var _ Pooler = (*ConnPool)(nil)

View File

@ -6,8 +6,6 @@ import (
"strconv"
)
const bufferSize = 4096
type WriteBuffer struct {
b []byte
}

View File

@ -30,19 +30,6 @@ func sliceParser(rd *proto.Reader, n int64) (interface{}, error) {
return vals, nil
}
// Implements proto.MultiBulkParse
func intSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
ints := make([]int64, 0, n)
for i := int64(0); i < n; i++ {
n, err := rd.ReadIntReply()
if err != nil {
return nil, err
}
ints = append(ints, n)
}
return ints, nil
}
// Implements proto.MultiBulkParse
func boolSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
bools := make([]bool, 0, n)
@ -72,19 +59,6 @@ func stringSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
return ss, nil
}
// Implements proto.MultiBulkParse
func floatSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
nn := make([]float64, 0, n)
for i := int64(0); i < n; i++ {
n, err := rd.ReadFloatReply()
if err != nil {
return nil, err
}
nn = append(nn, n)
}
return nn, nil
}
// Implements proto.MultiBulkParse
func stringStringMapParser(rd *proto.Reader, n int64) (interface{}, error) {
m := make(map[string]string, n/2)

View File

@ -3,7 +3,6 @@ package redis
import (
"fmt"
"net"
"sync"
"time"
"github.com/go-redis/redis/internal"
@ -17,7 +16,6 @@ type PubSub struct {
base baseClient
cmd *Cmd
mu sync.Mutex
channels []string
patterns []string
}

View File

@ -59,6 +59,7 @@ var _ = Describe("Client", func() {
It("should close pubsub without closing the client", func() {
pubsub, err := client.Subscribe()
Expect(err).NotTo(HaveOccurred())
Expect(pubsub.Close()).NotTo(HaveOccurred())
_, err = pubsub.Receive()
@ -92,6 +93,7 @@ var _ = Describe("Client", func() {
It("should close pubsub when client is closed", func() {
pubsub, err := client.Subscribe()
Expect(err).NotTo(HaveOccurred())
Expect(client.Close()).NotTo(HaveOccurred())
_, err = pubsub.Receive()