Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Mar 31, 2017
1 parent 18dcec2 commit ef95182
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 33 deletions.
2 changes: 0 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: "-",
Expand Down
1 change: 0 additions & 1 deletion internal/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ type ConnPool struct {
stats Stats

_closed int32 // atomic
lastErr atomic.Value
}

var _ Pooler = (*ConnPool)(nil)
Expand Down
2 changes: 0 additions & 2 deletions internal/proto/write_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"strconv"
)

const bufferSize = 4096

type WriteBuffer struct {
b []byte
}
Expand Down
26 changes: 0 additions & 26 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package redis
import (
"fmt"
"net"
"sync"
"time"

"github.com/go-redis/redis/internal"
Expand All @@ -17,7 +16,6 @@ type PubSub struct {
base baseClient
cmd *Cmd

mu sync.Mutex
channels []string
patterns []string
}
Expand Down
2 changes: 2 additions & 0 deletions redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ef95182

Please sign in to comment.