File tree Expand file tree Collapse file tree 3 files changed +6
-20
lines changed
Expand file tree Collapse file tree 3 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -198,14 +198,3 @@ func newConnPool(opt *Options) *pool.ConnPool {
198198 IdleCheckFrequency : opt .IdleCheckFrequency ,
199199 })
200200}
201-
202- // PoolStats contains pool state information and accumulated stats.
203- type PoolStats struct {
204- Requests uint32 // number of times a connection was requested by the pool
205- Hits uint32 // number of times free connection was found in the pool
206- Timeouts uint32 // number of times a wait timeout occurred
207-
208- TotalConns uint32 // number of total connections in the pool
209- FreeConns uint32 // number of free connections in the pool
210- StaleConns uint32 // number of stale connections removed from the pool
211- }
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ var _ = Describe("pool", func() {
125125 Timeouts : 0 ,
126126 TotalConns : 1 ,
127127 FreeConns : 1 ,
128+ StaleConns : 0 ,
128129 }))
129130
130131 time .Sleep (2 * time .Second )
@@ -136,6 +137,7 @@ var _ = Describe("pool", func() {
136137 Timeouts : 0 ,
137138 TotalConns : 0 ,
138139 FreeConns : 0 ,
140+ StaleConns : 1 ,
139141 }))
140142 })
141143})
Original file line number Diff line number Diff line change @@ -352,17 +352,12 @@ func (c *Client) Options() *Options {
352352 return c .opt
353353}
354354
355+ type PoolStats pool.Stats
356+
355357// PoolStats returns connection pool stats.
356358func (c * Client ) PoolStats () * PoolStats {
357- s := c .connPool .Stats ()
358- return & PoolStats {
359- Requests : s .Requests ,
360- Hits : s .Hits ,
361- Timeouts : s .Timeouts ,
362-
363- TotalConns : s .TotalConns ,
364- FreeConns : s .FreeConns ,
365- }
359+ stats := c .connPool .Stats ()
360+ return (* PoolStats )(stats )
366361}
367362
368363func (c * Client ) Pipelined (fn func (Pipeliner ) error ) ([]Cmder , error ) {
You can’t perform that action at this time.
0 commit comments