2
0

pgxpool: health check should avoid going below minConns

This commit is contained in:
James Hartig
2022-05-26 10:49:57 -04:00
committed by Jack Christensen
parent 37c3f157bc
commit a814153aeb
4 changed files with 212 additions and 45 deletions
+21 -1
View File
@@ -8,7 +8,10 @@ import (
// Stat is a snapshot of Pool statistics.
type Stat struct {
s *puddle.Stat
s *puddle.Stat
newConnsCount int64
lifetimeDestroyCount int64
idleDestroyCount int64
}
// AcquireCount returns the cumulative count of successful acquires from the pool.
@@ -62,3 +65,20 @@ func (s *Stat) MaxConns() int32 {
func (s *Stat) TotalConns() int32 {
return s.s.TotalResources()
}
// NewConnsCount returns the cumulative count of new connections opened.
func (s *Stat) NewConnsCount() int64 {
return s.newConnsCount
}
// MaxLifetimeDestroyCount returns the cumulative count of connections destroyed
// because they exceeded MaxConnLifetime.
func (s *Stat) MaxLifetimeDestroyCount() int64 {
return s.lifetimeDestroyCount
}
// MaxIdleDestroyCount returns the cumulative count of connections destroyed because
// they exceeded MaxConnIdleTime.
func (s *Stat) MaxIdleDestroyCount() int64 {
return s.idleDestroyCount
}