Skip to content

Commit be104ac

Browse files
authored
Merge pull request #177 from wzy9607/fix/resolver
fix: pass shuffle param to StaticResolver
2 parents e2fda1b + 37ae91e commit be104ac

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

connection.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"math/rand"
55

66
amqp "github.com/rabbitmq/amqp091-go"
7+
78
"github.com/wagslane/go-rabbitmq/internal/connectionmanager"
89
)
910

@@ -26,16 +27,16 @@ type Config amqp.Config
2627
type Resolver = connectionmanager.Resolver
2728

2829
type StaticResolver struct {
29-
urls []string
30-
shuffe bool
30+
urls []string
31+
shuffle bool
3132
}
3233

3334
func (r *StaticResolver) Resolve() ([]string, error) {
3435
// TODO: move to slices.Clone when supported Go versions > 1.21
3536
var urls []string
3637
urls = append(urls, r.urls...)
3738

38-
if r.shuffe {
39+
if r.shuffle {
3940
rand.Shuffle(len(urls), func(i, j int) {
4041
urls[i], urls[j] = urls[j], urls[i]
4142
})
@@ -44,7 +45,7 @@ func (r *StaticResolver) Resolve() ([]string, error) {
4445
}
4546

4647
func NewStaticResolver(urls []string, shuffle bool) *StaticResolver {
47-
return &StaticResolver{urls: urls}
48+
return &StaticResolver{urls: urls, shuffle: shuffle}
4849
}
4950

5051
// NewConn creates a new connection manager

0 commit comments

Comments
 (0)