diff --git a/Resources/config/session.xml b/Resources/config/session.xml index b9a6cba1..f0cb2369 100644 --- a/Resources/config/session.xml +++ b/Resources/config/session.xml @@ -11,7 +11,7 @@ - + %session.storage.options% %snc_redis.session.prefix% diff --git a/SncRedisBundle.php b/SncRedisBundle.php index 66d0dddd..01da6525 100644 --- a/SncRedisBundle.php +++ b/SncRedisBundle.php @@ -32,4 +32,17 @@ public function build(ContainerBuilder $container) $container->addCompilerPass(new MonologPass()); $container->addCompilerPass(new SwiftMailerPass()); } + + /** + * {@inheritDoc} + */ + public function shutdown() + { + // Close session handler connection to avoid using up all available connection slots in tests + if ($this->container->has('snc_redis.session.handler')) { + if (!method_exists($this->container, 'initialized') || $this->container->initialized('snc_redis.session.handler')) { + $this->container->get('snc_redis.session.handler')->close(); + } + } + } }