From 4984011ac687c14ccfc50112b7b3ffdb720e6eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9B=A8=E4=BB=81?= Date: Thu, 13 Jun 2024 14:06:07 +0800 Subject: [PATCH] Fix worker redis address configuration mapping bug. --- config/config.go | 16 ++++++++-------- config/viper_config.go | 2 +- worker/worker.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index d56a3f1a..507be79c 100644 --- a/config/config.go +++ b/config/config.go @@ -461,9 +461,9 @@ func newDefaultClusterSDConfig() *ClusterSDConfig { // WorkerConfig provides worker configuration type WorkerConfig struct { Redis struct { - ServerURL string `mapstructure:"serverurl"` - Pool string `mapstructure:"pool"` - Password string `mapstructure:"password"` + Address string `mapstructure:"address"` + Pool string `mapstructure:"pool"` + Password string `mapstructure:"password"` } `mapstructure:"redis"` Namespace string `mapstructure:"namespace"` Concurrency int `mapstructure:"concurrency"` @@ -474,12 +474,12 @@ type WorkerConfig struct { func newDefaultWorkerConfig() *WorkerConfig { return &WorkerConfig{ Redis: struct { - ServerURL string `mapstructure:"serverurl"` - Pool string `mapstructure:"pool"` - Password string `mapstructure:"password"` + Address string `mapstructure:"address"` + Pool string `mapstructure:"pool"` + Password string `mapstructure:"password"` }{ - ServerURL: "localhost:6379", - Pool: "10", + Address: "localhost:6379", + Pool: "10", }, Concurrency: 1, Retry: *newDefaultEnqueueOpts(), diff --git a/config/viper_config.go b/config/viper_config.go index cb38ef21..252792f0 100644 --- a/config/viper_config.go +++ b/config/viper_config.go @@ -130,7 +130,7 @@ func (c *Config) fillDefaultValues() { "pitaya.session.drain.period": pitayaConfig.Session.Drain.Period, "pitaya.worker.concurrency": pitayaConfig.Worker.Concurrency, "pitaya.worker.redis.pool": pitayaConfig.Worker.Redis.Pool, - "pitaya.worker.redis.url": pitayaConfig.Worker.Redis.ServerURL, + "pitaya.worker.redis.address": pitayaConfig.Worker.Redis.Address, "pitaya.worker.redis.password": pitayaConfig.Worker.Redis.Password, "pitaya.worker.retry.enabled": pitayaConfig.Worker.Retry.Enabled, "pitaya.worker.retry.exponential": pitayaConfig.Worker.Retry.Exponential, diff --git a/worker/worker.go b/worker/worker.go index 7883aa6e..b72b9293 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -55,7 +55,7 @@ func NewWorker(config config.WorkerConfig, opts config.EnqueueOpts) (*Worker, er } workers.Configure(workers.Options{ - Address: config.Redis.ServerURL, + Address: config.Redis.Address, Password: config.Redis.Password, Namespace: config.Namespace, ProcessID: hostname,