Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: redis/rueidis
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.36
Choose a base ref
...
head repository: redis/rueidis
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.37
Choose a head ref
  • 4 commits
  • 12 files changed
  • 2 contributors

Commits on May 9, 2024

  1. add linters go vet and staticcheck

    fix: staticcheck S1021
    fix: valkey-io/valkey-go#6
    
    Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
    Signed-off-by: Rueian <rueiancsie@gmail.com>
    szuecs authored and rueian committed May 9, 2024

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Copy the full SHA
    1ae39a7 View commit details

Commits on May 10, 2024

  1. fix: panic when initializing rueidis.Client while Redis Cluster is no…

    …t available
    
    Signed-off-by: Rueian <rueiancsie@gmail.com>
    rueian committed May 10, 2024
    Copy the full SHA
    2bd37fb View commit details
  2. Merge pull request #544 from redis/fix-panic-on-no-cluster

    fix: panic when initializing rueidis.Client while Redis Cluster is not available
    rueian authored May 10, 2024
    Copy the full SHA
    ebd66b7 View commit details

Commits on May 12, 2024

  1. feat: bump v1.0.37

    Signed-off-by: Rueian <rueiancsie@gmail.com>
    rueian committed May 12, 2024
    Copy the full SHA
    b514a56 View commit details
Showing with 47 additions and 15 deletions.
  1. +4 −4 cluster.go
  2. +20 −0 cluster_test.go
  3. +13 −0 dockertest.sh
  4. +1 −1 mock/go.mod
  5. +1 −1 om/go.mod
  6. +1 −1 pipe.go
  7. +1 −1 rueidisaside/go.mod
  8. +1 −2 rueidiscompat/adapter.go
  9. +1 −1 rueidiscompat/go.mod
  10. +2 −2 rueidishook/go.mod
  11. +1 −1 rueidisotel/go.mod
  12. +1 −1 rueidisprob/go.mod
8 changes: 4 additions & 4 deletions cluster.go
Original file line number Diff line number Diff line change
@@ -92,8 +92,8 @@ type connrole struct {
replica bool
}

func newClusterClient(opt *ClientOption, connFn connFn) (client *clusterClient, err error) {
client = &clusterClient{
func newClusterClient(opt *ClientOption, connFn connFn) (*clusterClient, error) {
client := &clusterClient{
cmd: cmds.NewBuilder(cmds.InitSlot),
connFn: connFn,
opt: opt,
@@ -120,11 +120,11 @@ func newClusterClient(opt *ClientOption, connFn connFn) (client *clusterClient,
return cc
}

if err = client.init(); err != nil {
if err := client.init(); err != nil {
return nil, err
}

if err = client.refresh(context.Background()); err != nil {
if err := client.refresh(context.Background()); err != nil {
return client, err
}

20 changes: 20 additions & 0 deletions cluster_test.go
Original file line number Diff line number Diff line change
@@ -4330,3 +4330,23 @@ func TestClusterShardsParsing(t *testing.T) {
}
})
}

// https://github.com/redis/rueidis/issues/543
func TestConnectToNonAvailableCluster(t *testing.T) {
var wg sync.WaitGroup
for i := 0; i < 4; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for i := 0; i < 100; i++ {
_, err := NewClient(ClientOption{
InitAddress: []string{"127.0.0.1:3000", "127.0.0.1:3001", "127.0.0.1:3002"},
})
if err == nil {
t.Errorf("expected connect error")
}
}
}()
}
wg.Wait()
}
13 changes: 13 additions & 0 deletions dockertest.sh
Original file line number Diff line number Diff line change
@@ -2,6 +2,19 @@

set -ev

go vet ./...

go install honnef.co/go/tools/cmd/staticcheck@latest
# disabled checks
# -ST1000 missing package doc in internal packages
# -ST1003 wrong naming convention would require breaking changes
# -ST1012 wrong error name convention in om package would require breaking changes
# -ST1016 violation of methods on the same type should have the same receiver name in rueidishook
# -ST1020 violation of go doc comment on exported methods in rueidiscompat
# -ST1021 violation of go doc comment on exported types in rueidiscompat
# -U1000 unused check in mock package
staticcheck -checks "all,-ST1000,-ST1003,-ST1012,-ST1016,-ST1020,-ST1021,-U1000" ./... | (grep -v "_test.go:" && exit 1 || exit 0)

trap "docker-compose down -v" EXIT
docker-compose up -d
sleep 5
2 changes: 1 addition & 1 deletion mock/go.mod
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ go 1.20
replace github.com/redis/rueidis => ../

require (
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
go.uber.org/mock v0.3.0
)

2 changes: 1 addition & 1 deletion om/go.mod
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ replace github.com/redis/rueidis => ../

require (
github.com/oklog/ulid/v2 v2.1.0
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
)

require golang.org/x/sys v0.19.0 // indirect
2 changes: 1 addition & 1 deletion pipe.go
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import (
)

const LibName = "rueidis"
const LibVer = "1.0.36"
const LibVer = "1.0.37"

var noHello = regexp.MustCompile("unknown command .?(HELLO|hello).?")

2 changes: 1 addition & 1 deletion rueidisaside/go.mod
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ replace github.com/redis/rueidis => ../

require (
github.com/oklog/ulid/v2 v2.1.0
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
)

require golang.org/x/sys v0.19.0 // indirect
3 changes: 1 addition & 2 deletions rueidiscompat/adapter.go
Original file line number Diff line number Diff line change
@@ -707,8 +707,7 @@ func (c *Compat) Keys(ctx context.Context, pattern string) *StringSliceCmd {
}

func (c *Compat) Migrate(ctx context.Context, host string, port int64, key string, db int64, timeout time.Duration) *StatusCmd {
var cmd rueidis.Completed
cmd = c.client.B().Migrate().Host(host).Port(port).Key(key).DestinationDb(db).Timeout(formatSec(timeout)).Build()
cmd := c.client.B().Migrate().Host(host).Port(port).Key(key).DestinationDb(db).Timeout(formatSec(timeout)).Build()
resp := c.client.Do(ctx, cmd)
return newStatusCmd(resp)
}
2 changes: 1 addition & 1 deletion rueidiscompat/go.mod
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ replace github.com/redis/rueidis => ../
require (
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.1
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
)

require (
4 changes: 2 additions & 2 deletions rueidishook/go.mod
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ replace (
)

require (
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis/mock v1.0.36
github.com/redis/rueidis v1.0.37
github.com/redis/rueidis/mock v1.0.37
go.uber.org/mock v0.4.0
)

2 changes: 1 addition & 1 deletion rueidisotel/go.mod
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ go 1.20
replace github.com/redis/rueidis => ../

require (
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/metric v1.24.0
go.opentelemetry.io/otel/sdk v1.24.0
2 changes: 1 addition & 1 deletion rueidisprob/go.mod
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ go 1.20.0
replace github.com/redis/rueidis => ../

require (
github.com/redis/rueidis v1.0.36
github.com/redis/rueidis v1.0.37
github.com/twmb/murmur3 v1.1.8
)