2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-27 00:02:19 +08:00

(cli:fix) Read --cluster flag from config file

This commit is contained in:
Ken Hibino 2022-12-18 20:27:02 -08:00
parent c08f142b56
commit 0b8cfad703

View File

@ -351,7 +351,7 @@ func initConfig() {
// createRDB creates a RDB instance using flag values and returns it. // createRDB creates a RDB instance using flag values and returns it.
func createRDB() *rdb.RDB { func createRDB() *rdb.RDB {
var c redis.UniversalClient var c redis.UniversalClient
if useRedisCluster { if viper.GetBool("cluster") {
addrs := strings.Split(viper.GetString("cluster_addrs"), ",") addrs := strings.Split(viper.GetString("cluster_addrs"), ",")
c = redis.NewClusterClient(&redis.ClusterOptions{ c = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addrs, Addrs: addrs,
@ -375,7 +375,7 @@ func createInspector() *asynq.Inspector {
} }
func getRedisConnOpt() asynq.RedisConnOpt { func getRedisConnOpt() asynq.RedisConnOpt {
if useRedisCluster { if viper.GetBool("cluster") {
addrs := strings.Split(viper.GetString("cluster_addrs"), ",") addrs := strings.Split(viper.GetString("cluster_addrs"), ",")
return asynq.RedisClusterClientOpt{ return asynq.RedisClusterClientOpt{
Addrs: addrs, Addrs: addrs,