Skip to content

Commit 4e59e2f

Browse files
committed
[pubsub] refactor Redis backend for internal client init
1 parent 5361d6e commit 4e59e2f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

internal/sms-gateway/pubsub/pubsub.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"fmt"
55
"net/url"
66

7-
"github.com/android-sms-gateway/core/redis"
87
"github.com/android-sms-gateway/server/pkg/pubsub"
98
)
109

@@ -31,11 +30,11 @@ func New(config Config) (PubSub, error) {
3130
case "memory":
3231
return pubsub.NewMemory(opts...), nil
3332
case "redis":
34-
client, err := redis.New(redis.Config{URL: config.URL})
35-
if err != nil {
36-
return nil, fmt.Errorf("can't create redis client: %w", err)
37-
}
38-
return pubsub.NewRedis(client, topicPrefix, opts...), nil
33+
return pubsub.NewRedis(pubsub.RedisConfig{
34+
Client: nil,
35+
URL: config.URL,
36+
Prefix: topicPrefix,
37+
}, opts...)
3938
default:
4039
return nil, fmt.Errorf("invalid scheme: %s", u.Scheme)
4140
}

0 commit comments

Comments
 (0)