Change NewClient API to take *redis.Client

This commit is contained in:
Ken Hibino
2019-12-29 13:42:49 -08:00
parent ae0c2f9ca5
commit 62624cb0d8
4 changed files with 11 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ package asynq
import (
"time"
"github.com/go-redis/redis/v7"
"github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/rdb"
"github.com/rs/xid"
@@ -19,9 +20,9 @@ type Client struct {
}
// NewClient and returns a new Client given a redis configuration.
func NewClient(cfg *RedisConfig) *Client {
r := rdb.NewRDB(newRedisClient(cfg))
return &Client{r}
func NewClient(r *redis.Client) *Client {
rdb := rdb.NewRDB(r)
return &Client{rdb}
}
// Option configures the behavior of task processing.