custom selection and error handler for NewPool

This commit is contained in:
John Ku 2015-12-10 10:14:03 -08:00
parent c6c6c9cac2
commit d17ea720c1
2 changed files with 4 additions and 3 deletions

View File

@ -60,10 +60,11 @@ type Pool struct {
} }
// Return a new pool. // Return a new pool.
func NewPool() (pool *Pool) { func NewPool(selectionFn SelectionHandler, errorFn ErrorHandler) (pool *Pool) {
return &Pool{ return &Pool{
clients: make(map[string]*poolClient, poolSize), clients: make(map[string]*poolClient, poolSize),
SelectionHandler: SelectWithRate, SelectionHandler: selectionFn,
ErrorHandler: errorFn,
} }
} }

View File

@ -5,7 +5,7 @@ import (
) )
var ( var (
pool = NewPool() pool = NewPool(selectWithRate, func(error) {})
) )
func TestPoolAdd(t *testing.T) { func TestPoolAdd(t *testing.T) {