keypool version: 0.4.7
Even when the state of the pool is PoolClosed a new resource can still be acquired.
Should an exception be thrown at this case?
Example:
val pool = KeyPool
.Builder(
(i: Int) => IO.ref(i),
(r: Ref[IO, Int]) => IO.unit
)
.build
for {
closedPool <- pool.use(kp => IO.pure(kp))
_ <- closedPool.take(1).use { ref =>
ref.get.flatMap(value => IO.println(s"created a new ref in the closed pool: $value"))
}
} yield ()
Output:
created a new ref in the closed pool: 1