2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-08 18:53:34 +08:00

Add DB field to RedisOpt to specify redis db index

This commit is contained in:
Ken Hibino
2019-11-24 18:41:55 -08:00
parent d5c2b9b995
commit f91004e6aa
3 changed files with 13 additions and 2 deletions

View File

@@ -20,7 +20,11 @@ type Background struct {
// NewBackground returns a new Background instance.
func NewBackground(numWorkers int, opt *RedisOpt) *Background {
client := redis.NewClient(&redis.Options{Addr: opt.Addr, Password: opt.Password})
client := redis.NewClient(&redis.Options{
Addr: opt.Addr,
Password: opt.Password,
DB: opt.DB,
})
rdb := newRDB(client)
poller := newPoller(rdb, 5*time.Second, []string{scheduled, retry})
processor := newProcessor(rdb, numWorkers, nil)