Skip to content

Commit

Permalink
Merge pull request #378 from shustrik/master
Browse files Browse the repository at this point in the history
issue #377
  • Loading branch information
skafandri authored Sep 3, 2016
2 parents 4f8c356 + 34197ad commit a7e14d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions DependencyInjection/Compiler/RegisterPartsPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class RegisterPartsPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$services = $container->findTaggedServiceIds('old_sound_rabbit_mq.base_amqp');
$container->setParameter('old_sound_rabbit_mq.base_amqp', array_keys($services));
if (!$container->hasDefinition('old_sound_rabbit_mq.parts_holder')) {
return;
}
Expand Down
10 changes: 7 additions & 3 deletions OldSoundRabbitMqBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ public function build(ContainerBuilder $container)
public function shutdown()
{
parent::shutdown();
$partHolder = $this->container->get('old_sound_rabbit_mq.parts_holder');
$connections = $partHolder->getParts("old_sound_rabbit_mq.base_amqp");
if (!$this->container->hasParameter('old_sound_rabbit_mq.base_amqp')) {
return;
}
$connections = $this->container->getParameter('old_sound_rabbit_mq.base_amqp');
foreach ($connections as $connection) {
$connection->close();
if ($this->container->initialized($connection)) {
$this->container->get($connection)->close();
}
}
}
}

0 comments on commit a7e14d9

Please sign in to comment.