Example #1
0
 /** {@inheritdoc} */
 public function warmUp($cacheDir)
 {
     foreach ($this->sharedWorkers as $sharedWorker) {
         $factory = $this->getFactory($sharedWorker[0]);
         $factory->getBootstrapProfile()->compileScriptWithExpression($sharedWorker[2], $sharedWorker[1], $scriptPath, $mustDeleteOnError);
         if ($mustDeleteOnError) {
             unlink($scriptPath);
             continue;
         }
         if (isset($sharedWorker[2]) && $sharedWorker[3]) {
             register_shutdown_function(function () use($factory, $scriptPath, $cacheDir) {
                 // HACK to start the worker after Symfony will have moved the cache directory
                 $factory->getBootstrapProfile()->getOrFindPhpExecutablePathAndArguments($php, $phpArgs);
                 $line = array_merge([$php], $phpArgs, [str_replace($cacheDir, dirname($cacheDir) . DIRECTORY_SEPARATOR . $this->container->getParameter('kernel.environment'), $scriptPath)]);
                 SharedWorker::startDaemon($line);
             });
         }
     }
 }
Example #2
0
 /**
  * @param string $socketAddress
  *
  * @throws Exception\LogicException
  * @throws Exception\RuntimeException
  *
  * @return Status\WorkerStatus
  */
 public function querySharedWorker($socketAddress)
 {
     return SharedWorker::queryWorker($socketAddress, $this->bootstrapProfile);
 }