File tree 3 files changed +6
-20
lines changed 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 {
198
198
IdleCheckFrequency : opt .IdleCheckFrequency ,
199
199
})
200
200
}
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() {
125
125
Timeouts : 0 ,
126
126
TotalConns : 1 ,
127
127
FreeConns : 1 ,
128
+ StaleConns : 0 ,
128
129
}))
129
130
130
131
time .Sleep (2 * time .Second )
@@ -136,6 +137,7 @@ var _ = Describe("pool", func() {
136
137
Timeouts : 0 ,
137
138
TotalConns : 0 ,
138
139
FreeConns : 0 ,
140
+ StaleConns : 1 ,
139
141
}))
140
142
})
141
143
})
Original file line number Diff line number Diff line change @@ -352,17 +352,12 @@ func (c *Client) Options() *Options {
352
352
return c .opt
353
353
}
354
354
355
+ type PoolStats pool.Stats
356
+
355
357
// PoolStats returns connection pool stats.
356
358
func (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 )
366
361
}
367
362
368
363
func (c * Client ) Pipelined (fn func (Pipeliner ) error ) ([]Cmder , error ) {
You can’t perform that action at this time.
0 commit comments