From e6386730d850f18b214da61eb6768ab37224bf43 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 22 Apr 2014 15:07:57 +0200 Subject: [PATCH] Use redisDB number too. --- common/queue.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/queue.go b/common/queue.go index 2f2fc0b..feee8b6 100644 --- a/common/queue.go +++ b/common/queue.go @@ -5,6 +5,8 @@ import ( "net/url" "os" "time" + "strconv" + "strings" "github.com/golang/glog" "github.com/monnand/goredis" @@ -94,7 +96,13 @@ func NewRedisQueue() Queue { if err != nil { glog.Fatal("Could not read Redis string", err) } - redisQueue := goredis.Client{Addr: redisUrl.Host} + + redisDb, err := strconv.Atoi(strings.TrimLeft(redisUrl.Path, "/")) + if err != nil { + glog.Fatal("Could not read Redis path", err) + } + + redisQueue := goredis.Client{Addr: redisUrl.Host, Db: redisDb} s := RedisQueue{queue: &redisQueue} s.waitForRedis() return &s