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

Commit

Permalink
Use redisDB number too.
Browse files Browse the repository at this point in the history
  • Loading branch information
bartTC committed Apr 22, 2014
1 parent c31b353 commit e638673
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"net/url"
"os"
"time"
"strconv"
"strings"

"github.com/golang/glog"
"github.com/monnand/goredis"
Expand Down Expand Up @@ -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
Expand Down

1 comment on commit e638673

@bartTC
Copy link
Member Author

@bartTC bartTC commented on e638673 Apr 22, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yml this bug was very weird. Botbot always wrote to the db:0 by default, it never took care of a custom db number.

It worked because this was set to 0 by default. Remember that I set db numbers explicitly like this to test this issue? I have no idea why we did not stumbled over this.

export REDIS_PLUGIN_STORAGE_URL=redis://localhost:6379/0
export REDIS_PLUGIN_QUEUE_URL=redis://localhost:6379/0
export REDIS_SSEQUEUE_URL=redis://localhost:6379/0

Please sign in to comment.