2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-26 07:42:17 +08:00

fix client

This commit is contained in:
fajrifernanda 2024-12-04 13:36:27 +07:00
parent 9261e4318c
commit b689bb42e3

View File

@ -58,21 +58,18 @@ func NewClientWithConfig(r RedisConnOpt, cfg ClientConfig) *Client {
if !ok { if !ok {
panic(fmt.Sprintf("asynq: unsupported RedisConnOpt type %T", r)) panic(fmt.Sprintf("asynq: unsupported RedisConnOpt type %T", r))
} }
return &Client{broker: rdb.NewRDBWithConfig(c, rdb.RDBConfig{ return &Client{
MaxArchiveSize: cfg.MaxArchiveSize, broker: rdb.NewRDBWithConfig(c, rdb.RDBConfig{
ArchivedExpirationInDays: cfg.ArchivedExpirationInDays, MaxArchiveSize: cfg.MaxArchiveSize,
})} ArchivedExpirationInDays: cfg.ArchivedExpirationInDays,
}),
sharedConnection: false,
}
} }
// NewClient returns a new Client instance given a redis connection option. // NewClient returns a new Client instance given a redis connection option.
func NewClient(r RedisConnOpt) *Client { func NewClient(r RedisConnOpt) *Client {
redisClient, ok := r.MakeRedisClient().(redis.UniversalClient) return NewClientWithConfig(r, ClientConfig{})
if !ok {
panic(fmt.Sprintf("asynq: unsupported RedisConnOpt type %T", r))
}
client := NewClientFromRedisClient(redisClient)
client.sharedConnection = false
return client
} }
// NewClientFromRedisClient returns a new instance of Client given a redis.UniversalClient // NewClientFromRedisClient returns a new instance of Client given a redis.UniversalClient