mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 03:37:43 +00:00
tweak redis conns
This commit is contained in:
parent
624cebf8ef
commit
a00e4405c7
4 changed files with 5 additions and 5 deletions
|
@ -39,7 +39,7 @@ func APICmd(ctx context.Context) *cobra.Command {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
redis, err := cmdutil.NewRedisClient(ctx)
|
||||
redis, err := cmdutil.NewRedisClient(ctx, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
redis, err := cmdutil.NewRedisClient(ctx)
|
||||
redis, err := cmdutil.NewRedisClient(ctx, 2)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ func WorkerCmd(ctx context.Context) *cobra.Command {
|
|||
}
|
||||
defer db.Close()
|
||||
|
||||
redis, err := cmdutil.NewRedisClient(ctx)
|
||||
redis, err := cmdutil.NewRedisClient(ctx, poolSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ func NewStatsdClient(tags ...string) (*statsd.Client, error) {
|
|||
return statsd.New(os.Getenv("STATSD_URL"), statsd.WithTags(tags))
|
||||
}
|
||||
|
||||
func NewRedisClient(ctx context.Context) (*redis.Client, error) {
|
||||
func NewRedisClient(ctx context.Context, maxConns int) (*redis.Client, error) {
|
||||
opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opt.PoolSize = 16
|
||||
opt.PoolSize = maxConns
|
||||
|
||||
client := redis.NewClient(opt)
|
||||
if err := client.Ping(ctx).Err(); err != nil {
|
||||
|
|
Loading…
Reference in a new issue