From 79e9b849adf957443d97435f95b0378af3d14767 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Wed, 26 Sep 2018 12:27:31 -0500 Subject: [PATCH] Fail pending deferred if pool closed --- src/AbstractPool.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/AbstractPool.php b/src/AbstractPool.php index 4a4058b..043a7da 100644 --- a/src/AbstractPool.php +++ b/src/AbstractPool.php @@ -197,8 +197,13 @@ abstract class AbstractPool implements Pool $connection->close(); } $this->idle = new \SplQueue; - $this->connections = new \SplObjectStorage; $this->prepare = null; + + if ($this->deferred instanceof Deferred) { + $deferred = $this->deferred; + $this->deferred = null; + $deferred->fail(new FailureException("Connection pool closed")); + } } /**