Skip to content

Commit

Permalink
Fix redis pub/sub connection
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyuhang committed Feb 8, 2018
1 parent 13f38ba commit 5e99016
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ func GetPub() *redis.Client {
host := configs.GetString("redis.host")
port := configs.GetInt("redis.port")
db := configs.GetInt("redis.db")
password := configs.GetDynamicString("redis.password")

PubClient := redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("%s:%d", host, port),
Password: "",
DB: db,
Addr: fmt.Sprintf("%s:%d", host, port),
Password: password,
DB: db,
MaxRetries: 3,
})

return PubClient
Expand All @@ -48,11 +50,13 @@ func GetSub() *redis.Client {
host := configs.GetString("redis.host")
port := configs.GetInt("redis.port")
db := configs.GetInt("redis.db")
password := configs.GetDynamicString("redis.password")

SubClient := redis.NewClient(&redis.Options{
Addr: fmt.Sprintf("%s:%d", host, port),
Password: "",
DB: db,
Addr: fmt.Sprintf("%s:%d", host, port),
Password: password,
DB: db,
MaxRetries: 3,
})

return SubClient
Expand Down

0 comments on commit 5e99016

Please sign in to comment.