mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #426 from Icinga/bugfix/redis-connection-pool-timeout
Make sure Redis connection pool is large enough
This commit is contained in:
commit
0f64125af3
2 changed files with 11 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/icinga/icingadb/pkg/icingaredis"
|
||||
"github.com/icinga/icingadb/pkg/logging"
|
||||
"github.com/icinga/icingadb/pkg/retry"
|
||||
"github.com/icinga/icingadb/pkg/utils"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"net"
|
||||
|
|
@ -54,6 +55,7 @@ func (r *Redis) NewClient(logger *logging.Logger) (*icingaredis.Client, error) {
|
|||
|
||||
opts := c.Options()
|
||||
opts.MaxRetries = opts.PoolSize + 1 // https://github.com/go-redis/redis/issues/1737
|
||||
opts.PoolSize = utils.MaxInt(32, opts.PoolSize)
|
||||
c = redis.NewClient(opts)
|
||||
|
||||
return icingaredis.NewClient(c, logger, &r.Options), nil
|
||||
|
|
|
|||
|
|
@ -191,3 +191,12 @@ func AppName() string {
|
|||
|
||||
return filepath.Base(exe)
|
||||
}
|
||||
|
||||
// MaxInt returns the larger of the given integers.
|
||||
func MaxInt(x, y int) int {
|
||||
if x > y {
|
||||
return x
|
||||
}
|
||||
|
||||
return y
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue