Skip to content

Commit

Permalink
Merge pull request #471 from MOZGIII/checked-out-connections
Browse files Browse the repository at this point in the history
Added CheckedOutConnections for ConnPoolStat
  • Loading branch information
jackc authored Oct 29, 2018
2 parents c047f4d + e4632da commit 381a1e8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions conn_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ type ConnPoolStat struct {
AvailableConnections int // unused live connections
}

// CheckedOutConnections returns the amount of connections that are currently
// checked out from the pool.
func (stat *ConnPoolStat) CheckedOutConnections() int {
return stat.CurrentConnections - stat.AvailableConnections
}

// ErrAcquireTimeout occurs when an attempt to acquire a connection times out.
var ErrAcquireTimeout = errors.New("timeout acquiring connection from pool")

Expand Down

0 comments on commit 381a1e8

Please sign in to comment.