Skip to content

Commit

Permalink
Use a new container on each RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwdan committed Jul 18, 2019
1 parent 15b9b06 commit 0197958
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Voryx/ThruwayBundle/WampKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,15 @@ public function handleRPC($args, $argsKw, $details, MappingInterface $mapping)
//Force cleanup before making the call
$this->cleanup();

$controller = $this->container->get($mapping->getServiceId());
$newContainer = ContainerFactory::createContainer(
$this->container->getParameter('kernel.container_class'),
$this->container->get('thruway.client'),
$this->container->get('voryx.thruway.loop'),
$this->container
);

$controller = $newContainer->get($mapping->getServiceId());

$controllerArgs = $this->deserializeArgs($args, $mapping);

$this->setControllerContainerDetails($controller, $args, $argsKw, $details);
Expand Down Expand Up @@ -545,6 +553,10 @@ private function cleanup($controller = null)
}
$this->container->get('doctrine')->getManager()->clear();
}

if ($controller){
gc_collect_cycles();
}
}

/**
Expand Down

0 comments on commit 0197958

Please sign in to comment.