Skip to content

Commit

Permalink
Reduce dependency coupling for symfony/process
Browse files Browse the repository at this point in the history
Move symfony/process to an optional dependency (required for dev, suggested otherwise).
This is a preparation for #78.
  • Loading branch information
xelan committed Oct 7, 2020
1 parent d35cd7b commit 09f09e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
"predis/predis": "1.1.*",
"monolog/monolog": "~1.7",
"symfony/console": "~2.7|~3.0",
"symfony/yaml": "~2.7|~3.0",
"symfony/process": "~2.7|~3.0"
"symfony/yaml": "~2.7|~3.0"
},
"suggest": {
"ext-proctitle": "Allows php-resque to rename the title of UNIX processes to show the status of a worker in PHP versions < 5.5.0.",
"ext-phpiredis": "Native PHP extension for Redis connectivity. Predis will automatically utilize when available."
"ext-phpiredis": "Native PHP extension for Redis connectivity. Predis will automatically utilize when available.",
"symfony/process": "To run the speed test command."
},
"require-dev": {
"phpunit/phpunit": "~4.8",
"friendsofphp/php-cs-fixer": "~2.2.0"
"friendsofphp/php-cs-fixer": "~2.2.0",
"symfony/process": "~2.7|~3.0"
},
"bin": [
"bin/resque"
Expand Down
6 changes: 6 additions & 0 deletions src/Resque/Commands/SpeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
use Symfony\Component\Process\Process;
use Symfony\Component\Console\Helper\ProgressBar;

use Exception;

/**
* Performs a raw speed test
*
Expand All @@ -41,6 +43,10 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
if (!class_exists(Process::class)) {
throw new Exception('The Symfony process component is required to run the speed test.');
}

Resque\Redis::setConfig(array('namespace' => 'resque:speedtest'));

$testTime = (int)$input->getOption('time') ?: 5;
Expand Down

0 comments on commit 09f09e7

Please sign in to comment.