custom selection and error handler for NewPool
This commit is contained in:
parent
c6c6c9cac2
commit
d17ea720c1
@ -60,10 +60,11 @@ type Pool struct {
|
||||
}
|
||||
|
||||
// Return a new pool.
|
||||
func NewPool() (pool *Pool) {
|
||||
func NewPool(selectionFn SelectionHandler, errorFn ErrorHandler) (pool *Pool) {
|
||||
return &Pool{
|
||||
clients: make(map[string]*poolClient, poolSize),
|
||||
SelectionHandler: SelectWithRate,
|
||||
SelectionHandler: selectionFn,
|
||||
ErrorHandler: errorFn,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
pool = NewPool()
|
||||
pool = NewPool(selectWithRate, func(error) {})
|
||||
)
|
||||
|
||||
func TestPoolAdd(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user