Skip to content

Commit

Permalink
add connPoolSize limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dshiell committed Oct 21, 2024
1 parent 76d16ed commit 06ccf6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ type TLSConfig struct {
}

type RedisConnectorConfig struct {
Addr string `yaml:"addr" json:"addr"`
Password string `yaml:"password" json:"password"`
DB int `yaml:"db" json:"db"`
TLS *TLSConfig `yaml:"tls" json:"tls"`
Addr string `yaml:"addr" json:"addr"`
Password string `yaml:"password" json:"password"`
DB int `yaml:"db" json:"db"`
TLS *TLSConfig `yaml:"tls" json:"tls"`
ConnPoolSize int `yaml:"connPoolSize" json:"connPoolSize"`
}

func (r *RedisConnectorConfig) MarshalJSON() ([]byte, error) {
return sonic.Marshal(map[string]interface{}{
"addr": r.Addr,
"password": "REDACTED",
"db": r.DB,
"addr": r.Addr,
"password": "REDACTED",
"db": r.DB,
"connPoolSize": r.ConnPoolSize,
})
}

Expand Down
1 change: 1 addition & 0 deletions data/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (r *RedisConnector) connect(ctx context.Context, cfg *common.RedisConnector
Addr: cfg.Addr,
Password: cfg.Password,
DB: cfg.DB,
PoolSize: cfg.ConnPoolSize,
}

if cfg.TLS != nil && cfg.TLS.Enabled {
Expand Down

0 comments on commit 06ccf6a

Please sign in to comment.