refactor: align framework cleanup with new bootstrap flow
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@@ -24,16 +24,17 @@ type RedisConfig struct {
|
||||
// NewRedisClient 创建新的 Redis 客户端
|
||||
func NewRedisClient(cfg RedisConfig, logger *zap.Logger) (*redis.Client, error) {
|
||||
client := redis.NewClient(&redis.Options{
|
||||
Addr: cfg.Address,
|
||||
Password: cfg.Password,
|
||||
DB: cfg.DB,
|
||||
PoolSize: cfg.PoolSize,
|
||||
MinIdleConns: cfg.MinIdleConns,
|
||||
DialTimeout: cfg.DialTimeout,
|
||||
ReadTimeout: cfg.ReadTimeout,
|
||||
WriteTimeout: cfg.WriteTimeout,
|
||||
MaxRetries: 3,
|
||||
PoolTimeout: 4 * time.Second,
|
||||
Addr: cfg.Address,
|
||||
Password: cfg.Password,
|
||||
DB: cfg.DB,
|
||||
PoolSize: cfg.PoolSize,
|
||||
MinIdleConns: cfg.MinIdleConns,
|
||||
DialTimeout: cfg.DialTimeout,
|
||||
ReadTimeout: cfg.ReadTimeout,
|
||||
WriteTimeout: cfg.WriteTimeout,
|
||||
MaxRetries: 3,
|
||||
PoolTimeout: 4 * time.Second,
|
||||
DisableIndentity: true,
|
||||
})
|
||||
|
||||
// 测试连接
|
||||
@@ -41,7 +42,7 @@ func NewRedisClient(cfg RedisConfig, logger *zap.Logger) (*redis.Client, error)
|
||||
defer cancel()
|
||||
|
||||
if err := client.Ping(ctx).Err(); err != nil {
|
||||
return nil, fmt.Errorf("failed to connect to redis: %w", err)
|
||||
return nil, fmt.Errorf("redis连接错误: %w", err)
|
||||
}
|
||||
|
||||
logger.Info("Redis 连接成功",
|
||||
|
||||
Reference in New Issue
Block a user