Skip to content

Added configuration value for process-timeout #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function getConfigTreeBuilder()
->addDefaultsIfNotSet()
->children()
->scalarNode('console_path')->defaultValue('%kernel.root_dir%/../bin/console')->end()
->floatNode('process_timeout')->defaultNull()->end()
->end()
->end()
->end()
Expand Down
15 changes: 12 additions & 3 deletions src/Executor/ExecutionProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,20 @@ class ExecutionProcessFactory
*/
private $environment;

/**
* @var float|null
*/
private $processTimeout;

/**
* @param string $consolePath
* @param float|null $processTimeout
* @param string $environment
*/
public function __construct($consolePath, $environment)
public function __construct($consolePath, $processTimeout, $environment)
{
$this->consolePath = $consolePath;
$this->processTimeout = $processTimeout;
$this->environment = $environment;
}

Expand All @@ -40,7 +47,9 @@ public function __construct($consolePath, $environment)
public function create($uuid)
{
return $process = ProcessBuilder::create(
[$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]
)->getProcess();
[$this->consolePath, 'task:execute', $uuid, '--env=' . $this->environment]
)
->setTimeout($this->processTimeout)
->getProcess();
}
}
1 change: 1 addition & 0 deletions src/Resources/config/executor/separate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<service id="task.executor.separate.process_factory" class="Task\TaskBundle\Executor\ExecutionProcessFactory">
<argument type="string">%task.executor.console_path%</argument>
<argument type="string">%task.executor.process_timeout%</argument>
<argument type="string">%kernel.environment%</argument>
</service>
</services>
Expand Down