Merge pull request #471 from MOZGIII/checked-out-connections

Added CheckedOutConnections for ConnPoolStat
pull/476/head
Jack Christensen 2018-10-29 17:27:26 -05:00 committed by GitHub
commit 381a1e8156
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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")