NewPool takes Config
This allows for backwards compatible additions. No features are planned but this would make it easier if they are added.
This commit is contained in:
@@ -30,7 +30,7 @@ destructor := func(value net.Conn) {
|
||||
}
|
||||
maxPoolSize := 10
|
||||
|
||||
pool := puddle.NewPool(constructor, destructor, maxPoolSize)
|
||||
pool := puddle.NewPool[net.Conn](&puddle.Config[int]{Constructor: constructor, Destructor: destructor, MaxSize: maxPoolSize})
|
||||
|
||||
// Acquire resource from the pool.
|
||||
res, err := pool.Acquire(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user