Skip to content

Commit

Permalink
use github.com/go-redis/redis/v9 support redis 7.0 cluster,see: redis…
Browse files Browse the repository at this point in the history
  • Loading branch information
weedge committed Jan 13, 2023
1 parent f04b6aa commit b3ddbd9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
27 changes: 14 additions & 13 deletions doraemon/ai-creator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"text/template"
"time"

redis "github.com/go-redis/redis/v8"
redis "github.com/go-redis/redis/v9"
"github.com/gorilla/websocket"
"github.com/weedge/craftsman/doraemon/ai-creator/internal/api"
)
Expand Down Expand Up @@ -219,12 +219,12 @@ func connectToRedis(ctx context.Context, redisType string) {
WriteTimeout: 3 * time.Second,

// connect pool
PoolSize: 100,
MinIdleConns: 10,
MaxConnAge: 60 * time.Second,
PoolTimeout: 5 * time.Second,
IdleTimeout: 30 * time.Second,
IdleCheckFrequency: 3 * time.Second,
PoolSize: 100,
MinIdleConns: 10,
PoolTimeout: 5 * time.Second,
MaxIdleConns: 50,
ConnMaxIdleTime: 30 * time.Second,
ConnMaxLifetime: 60 * time.Second,

// To route commands by latency or randomly, enable one of the following.
//RouteByLatency: true,
Expand All @@ -245,15 +245,16 @@ func connectToRedis(ctx context.Context, redisType string) {
WriteTimeout: 3 * time.Second,

// connect pool
PoolSize: 100,
MinIdleConns: 10,
MaxConnAge: 60 * time.Second,
PoolTimeout: 5 * time.Second,
IdleTimeout: 30 * time.Second,
IdleCheckFrequency: 3 * time.Second,
PoolSize: 100,
MinIdleConns: 10,
PoolTimeout: 5 * time.Second,
MaxIdleConns: 50,
ConnMaxIdleTime: 30 * time.Second,
ConnMaxLifetime: 60 * time.Second,
})
}

// https://github.com/go-redis/redis/issues/2085
pong, err := rdb.Ping(ctx).Result()
if err == nil {
log.Println(pong, "ok")
Expand Down
2 changes: 1 addition & 1 deletion doraemon/ai-creator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/weedge/craftsman/doraemon/ai-creator
go 1.19

require (
github.com/go-redis/redis/v8 v8.11.5
github.com/go-redis/redis/v9 v9.0.0-rc.2
github.com/gorilla/websocket v1.5.0
)

Expand Down
18 changes: 11 additions & 7 deletions doraemon/ai-creator/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-redis/redis/v9 v9.0.0-rc.2 h1:IN1eI8AvJJeWHjMW/hlFAv2sAfvTun2DVksDDJ3a6a0=
github.com/go-redis/redis/v9 v9.0.0-rc.2/go.mod h1:cgBknjwcBJa2prbnuHH/4k/Mlj4r0pWNV2HBanHujfY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

0 comments on commit b3ddbd9

Please sign in to comment.