diff --git a/README.md b/README.md index 46bff5ea..52355663 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Redis client for Go -![build workflow](https://github.com/go-redis/redis/actions/workflows/build.yml/badge.svg) +[![build workflow](https://github.com/go-redis/redis/actions/workflows/build.yml/badge.svg)](https://github.com/go-redis/redis/actions) [![PkgGoDev](https://pkg.go.dev/badge/github.com/go-redis/redis/v8)](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc) [![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/) [![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj) diff --git a/main_test.go b/main_test.go index 24ba02ec..b63a09e0 100644 --- a/main_test.go +++ b/main_test.go @@ -2,7 +2,6 @@ package redis_test import ( "context" - "errors" "fmt" "net" "os" @@ -269,7 +268,7 @@ func (p *redisProcess) Close() error { if err := p.Client.Ping(ctx).Err(); err != nil { return nil } - return errors.New("client is not shutdown") + return fmt.Errorf("client %s is not shutdown", p.Options().Addr) }, 10*time.Second) if err != nil { return err diff --git a/redis.go b/redis.go index 84928d9b..704d9e51 100644 --- a/redis.go +++ b/redis.go @@ -341,6 +341,7 @@ func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool return writeCmd(wr, cmd) }) if err != nil { + atomic.StoreUint32(&retryTimeout, 1) return err } @@ -348,6 +349,8 @@ func (c *baseClient) _process(ctx context.Context, cmd Cmder, attempt int) (bool if err != nil { if cmd.readTimeout() == nil { atomic.StoreUint32(&retryTimeout, 1) + } else { + atomic.StoreUint32(&retryTimeout, 0) } return err } diff --git a/ring_test.go b/ring_test.go index e0f58b23..9610066c 100644 --- a/ring_test.go +++ b/ring_test.go @@ -137,12 +137,6 @@ var _ = Describe("Redis Ring", func() { It("uses 3 shards after setting it to 3 shards", func() { Expect(ring.Len(), 2) - // Start ringShard3. - var err error - ringShard3, err = startRedis(ringShard3Port) - Expect(err).NotTo(HaveOccurred()) - defer ringShard3.Close() - shardName1 := "ringShardOne" shardAddr1 := ":" + ringShard1Port wantShard1 := ring.ShardByName(shardName1)