Skip to content
This repository was archived by the owner on Nov 26, 2018. It is now read-only.

Commit e638673

Browse files
committed
Use redisDB number too.
1 parent c31b353 commit e638673

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

common/queue.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"net/url"
66
"os"
77
"time"
8+
"strconv"
9+
"strings"
810

911
"github.com/golang/glog"
1012
"github.com/monnand/goredis"
@@ -94,7 +96,13 @@ func NewRedisQueue() Queue {
9496
if err != nil {
9597
glog.Fatal("Could not read Redis string", err)
9698
}
97-
redisQueue := goredis.Client{Addr: redisUrl.Host}
99+
100+
redisDb, err := strconv.Atoi(strings.TrimLeft(redisUrl.Path, "/"))
101+
if err != nil {
102+
glog.Fatal("Could not read Redis path", err)
103+
}
104+
105+
redisQueue := goredis.Client{Addr: redisUrl.Host, Db: redisDb}
98106
s := RedisQueue{queue: &redisQueue}
99107
s.waitForRedis()
100108
return &s

0 commit comments

Comments
 (0)