gomod: bump all deps (mostly redis)

This commit is contained in:
Jimmy Zelinskie 2022-01-18 22:00:57 -05:00
parent 828edb8fd8
commit bb5460fccc
3 changed files with 449 additions and 62 deletions

16
go.mod
View file

@ -6,17 +6,23 @@ require (
github.com/SermoDigital/jose v0.9.2-0.20180104203859-803625baeddc github.com/SermoDigital/jose v0.9.2-0.20180104203859-803625baeddc
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect
github.com/alicebob/miniredis v2.5.0+incompatible github.com/alicebob/miniredis v2.5.0+incompatible
github.com/anacrolix/torrent v1.28.0 github.com/anacrolix/dht/v2 v2.15.1 // indirect
github.com/go-redsync/redsync v1.4.2 github.com/anacrolix/missinggo/v2 v2.5.3 // indirect
github.com/gomodule/redigo v2.0.0+incompatible github.com/anacrolix/torrent v1.40.0
github.com/go-redsync/redsync/v4 v4.5.0
github.com/gomodule/redigo v1.8.8
github.com/julienschmidt/httprouter v1.3.0 github.com/julienschmidt/httprouter v1.3.0
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103 github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103
github.com/minio/sha256-simd v0.1.1 github.com/minio/sha256-simd v1.0.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1 github.com/spf13/cobra v1.3.0
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb // indirect github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )

458
go.sum

File diff suppressed because it is too large Load diff

View file

@ -7,13 +7,14 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redsync/redsync" "github.com/go-redsync/redsync/v4"
"github.com/gomodule/redigo/redis" "github.com/go-redsync/redsync/v4/redis/redigo"
redigolib "github.com/gomodule/redigo/redis"
) )
// redisBackend represents a redis handler. // redisBackend represents a redis handler.
type redisBackend struct { type redisBackend struct {
pool *redis.Pool pool *redigolib.Pool
redsync *redsync.Redsync redsync *redsync.Redsync
} }
@ -27,7 +28,7 @@ func newRedisBackend(cfg *Config, u *redisURL, socketPath string) *redisBackend
ConnectTimeout: cfg.RedisConnectTimeout, ConnectTimeout: cfg.RedisConnectTimeout,
} }
pool := rc.NewPool() pool := rc.NewPool()
redsync := redsync.New([]redsync.Pool{pool}) redsync := redsync.New(redigo.NewPool(pool))
return &redisBackend{ return &redisBackend{
pool: pool, pool: pool,
redsync: redsync, redsync: redsync,
@ -35,7 +36,7 @@ func newRedisBackend(cfg *Config, u *redisURL, socketPath string) *redisBackend
} }
// open returns or creates instance of Redis connection. // open returns or creates instance of Redis connection.
func (rb *redisBackend) open() redis.Conn { func (rb *redisBackend) open() redigolib.Conn {
return rb.pool.Get() return rb.pool.Get()
} }
@ -48,11 +49,11 @@ type redisConnector struct {
} }
// NewPool returns a new pool of Redis connections // NewPool returns a new pool of Redis connections
func (rc *redisConnector) NewPool() *redis.Pool { func (rc *redisConnector) NewPool() *redigolib.Pool {
return &redis.Pool{ return &redigolib.Pool{
MaxIdle: 3, MaxIdle: 3,
IdleTimeout: 240 * time.Second, IdleTimeout: 240 * time.Second,
Dial: func() (redis.Conn, error) { Dial: func() (redigolib.Conn, error) {
c, err := rc.open() c, err := rc.open()
if err != nil { if err != nil {
return nil, err return nil, err
@ -68,7 +69,7 @@ func (rc *redisConnector) NewPool() *redis.Pool {
return c, err return c, err
}, },
// PINGs connections that have been idle more than 10 seconds // PINGs connections that have been idle more than 10 seconds
TestOnBorrow: func(c redis.Conn, t time.Time) error { TestOnBorrow: func(c redigolib.Conn, t time.Time) error {
if time.Since(t) < 10*time.Second { if time.Since(t) < 10*time.Second {
return nil return nil
} }
@ -79,23 +80,23 @@ func (rc *redisConnector) NewPool() *redis.Pool {
} }
// Open a new Redis connection // Open a new Redis connection
func (rc *redisConnector) open() (redis.Conn, error) { func (rc *redisConnector) open() (redigolib.Conn, error) {
opts := []redis.DialOption{ opts := []redigolib.DialOption{
redis.DialDatabase(rc.URL.DB), redigolib.DialDatabase(rc.URL.DB),
redis.DialReadTimeout(rc.ReadTimeout), redigolib.DialReadTimeout(rc.ReadTimeout),
redis.DialWriteTimeout(rc.WriteTimeout), redigolib.DialWriteTimeout(rc.WriteTimeout),
redis.DialConnectTimeout(rc.ConnectTimeout), redigolib.DialConnectTimeout(rc.ConnectTimeout),
} }
if rc.URL.Password != "" { if rc.URL.Password != "" {
opts = append(opts, redis.DialPassword(rc.URL.Password)) opts = append(opts, redigolib.DialPassword(rc.URL.Password))
} }
if rc.SocketPath != "" { if rc.SocketPath != "" {
return redis.Dial("unix", rc.SocketPath, opts...) return redigolib.Dial("unix", rc.SocketPath, opts...)
} }
return redis.Dial("tcp", rc.URL.Host, opts...) return redigolib.Dial("tcp", rc.URL.Host, opts...)
} }
// A redisURL represents a parsed redisURL // A redisURL represents a parsed redisURL