Skip to content

Commit 7576574

Browse files
committed
feat✨: 升级V9
1 parent 97c556b commit 7576574

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

Diff for: consumer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sync"
88
"time"
99

10-
"github.com/go-redis/redis/v8"
10+
"github.com/go-redis/redis/v9"
1111
"github.com/pkg/errors"
1212
)
1313

Diff for: consumer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/go-redis/redis/v8"
9+
"github.com/go-redis/redis/v9"
1010
"github.com/pkg/errors"
1111
"github.com/stretchr/testify/assert"
1212
"github.com/stretchr/testify/require"

Diff for: go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ go 1.12
55
require (
66
github.com/fatih/color v1.7.0 // indirect
77
github.com/git-chglog/git-chglog v0.0.0-20190611050339-63a4e637021f
8-
github.com/go-redis/redis/v8 v8.11.5
8+
github.com/go-redis/redis/v9 v9.0.0-rc.1
99
github.com/imdario/mergo v0.3.7 // indirect
1010
github.com/mattn/go-colorable v0.1.2 // indirect
1111
github.com/mattn/goveralls v0.0.2
1212
github.com/pborman/uuid v1.2.0 // indirect
1313
github.com/pkg/errors v0.9.1
14-
github.com/stretchr/testify v1.5.1
14+
github.com/stretchr/testify v1.8.0
1515
github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df // indirect
1616
github.com/urfave/cli v1.20.0 // indirect
1717
gopkg.in/AlecAivazis/survey.v1 v1.8.5 // indirect

Diff for: producer.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package redisqueue
22

33
import (
44
"context"
5-
"github.com/go-redis/redis/v8"
5+
"github.com/go-redis/redis/v9"
66
)
77

88
// ProducerOptions provide options to configure the Producer.
@@ -81,11 +81,11 @@ func (p *Producer) Enqueue(msg *Message) error {
8181
Stream: msg.Stream,
8282
Values: msg.Values,
8383
}
84-
if p.options.ApproximateMaxLength {
85-
args.MaxLenApprox = p.options.StreamMaxLength
86-
} else {
87-
args.MaxLen = p.options.StreamMaxLength
88-
}
84+
//if p.options.ApproximateMaxLength {
85+
// args.MaxLenApprox = p.options.StreamMaxLength
86+
//} else {
87+
args.MaxLen = p.options.StreamMaxLength
88+
//}
8989
id, err := p.redis.XAdd(context.TODO(), args).Result()
9090
if err != nil {
9191
return err

Diff for: redis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strconv"
88
"strings"
99

10-
"github.com/go-redis/redis/v8"
10+
"github.com/go-redis/redis/v9"
1111
"github.com/pkg/errors"
1212
)
1313

Diff for: redis_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package redisqueue
22

33
import (
4+
"context"
45
"testing"
56

67
"github.com/stretchr/testify/assert"
@@ -12,14 +13,14 @@ func TestNewRedisClient(t *testing.T) {
1213
options := &RedisOptions{}
1314
r := newRedisClient(options)
1415

15-
err := r.Ping().Err()
16+
err := r.Ping(context.TODO()).Err()
1617
assert.NoError(tt, err)
1718
})
1819

1920
t.Run("defaults options if it's nil", func(tt *testing.T) {
2021
r := newRedisClient(nil)
2122

22-
err := r.Ping().Err()
23+
err := r.Ping(context.TODO()).Err()
2324
assert.NoError(tt, err)
2425
})
2526
}

0 commit comments

Comments
 (0)