Skip to content

Loading…

fix configuration parameters #45

Open
wants to merge 1 commit into from

6 participants

@tonypiper
Collaborator

these were incorrectly defined in #37 and reported in #44. I'm unable to test this at the moment - will check next week.

@michelsalib
Owner

Hey @tonypiper is this PR ok ?

@tonypiper
Collaborator
@lightglitch

In my case the worker gets the configurations from correctly from the config:

bcc_resque.vendor_dir   ''
bcc_resque.class    ''
bcc_resque.prefix   ''
bcc_resque.redis.host   ''
bcc_resque.redis.port   ''
bcc_resque.redis.database   ''
bcc_resque.resque.vendor_dir    /var/www/app/../vendor
bcc_resque.resque.class     BCC\ResqueBundle\Resque
bcc_resque.resque.redis.host    20.0.1.76
bcc_resque.resque.redis.port    6379
bcc_resque.resque.redis.database    1 

My problem is that the version in the composer (1.2) doesn't support the REDIS_BACKEND_DB or the PREFIX, that's why it doesn't work.

So you need to change the composer and make the commands compatible with the new version if you want to use this parameters.

@lightglitch

I have a branch that I use for this: https://github.com/lightglitch/php-resque/tree/branch-1.2

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/lightglitch/php-resque.git"
        }
    ],
    "require": {
        "chrisboulton/php-resque": "dev-branch-1.2 as 1.2",
    },

@tonypiper and @michelsalib How are you able to use this parameters on your version?

@ruudk
Collaborator

I don't think this PR is correct because it doesn't change anything to the setParameter calls here: https://github.com/michelsalib/BCCResqueBundle/blob/master/DependencyInjection/BCCResqueExtension.php#L28:L32

@tobiaskluge

The problem is that referenced version of php-resque and php-resque-scheduler not set the database correctly.
@lightglitch correctly fixed this for php-resque, you would need to do something similar for php-resque-scheduler until the dependency of BCCResqueBundle to these libs is updated.

You need to replace the following lines from vendor/chrisboulton/php-resque-scheduler/resque-scheduler

$REDIS_BACKEND = getenv('REDIS_BACKEND');
if(!empty($REDIS_BACKEND)) {
    Resque::setBackend($REDIS_BACKEND);
}

with

$REDIS_BACKEND = getenv('REDIS_BACKEND');
$REDIS_BACKEND_DB = getenv('REDIS_BACKEND_DB');
if(!empty($REDIS_BACKEND)) {
    if (empty($REDIS_BACKEND_DB))
        Resque::setBackend($REDIS_BACKEND);
    else
        Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB);
}
@lightglitch

I also have a fork of php-resque-scheduler with that fixed.

@michelsalib
Owner

Hi, I just made a cleanup of the PRs, can we handle this issue now ?

@mrbase
Collaborator

after the merge of #58 we should be able to test the patch

@mrbase
Collaborator

is this PR an issue anymore ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 30, 2013
  1. @tonypiper

    fix configuration parameters

    tonypiper committed
Showing with 10 additions and 10 deletions.
  1. +4 −4 Command/StartScheduledWorkerCommand.php
  2. +6 −6 Command/StartWorkerCommand.php
View
8 Command/StartScheduledWorkerCommand.php
@@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$env = array(
- 'APP_INCLUDE' => $this->getContainer()->getParameter('bcc_resque.resque.vendor_dir').'/autoload.php',
+ 'APP_INCLUDE' => $this->getContainer()->getParameter('bcc_resque.vendor_dir').'/autoload.php',
'VVERBOSE' => 1,
'RESQUE_PHP' => $this->getContainer()->getParameter('bcc_resque.resque.vendor_dir').'/chrisboulton/php-resque/lib/Resque.php',
);
@@ -42,9 +42,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$env['PREFIX'] = $this->getContainer()->getParameter('bcc_resque.prefix');
}
- $redisHost = $this->getContainer()->getParameter('bcc_resque.resque.redis.host');
- $redisPort = $this->getContainer()->getParameter('bcc_resque.resque.redis.port');
- $redisDatabase = $this->getContainer()->getParameter('bcc_resque.resque.redis.database');
+ $redisHost = $this->getContainer()->getParameter('bcc_resque.redis.host');
+ $redisPort = $this->getContainer()->getParameter('bcc_resque.redis.port');
+ $redisDatabase = $this->getContainer()->getParameter('bcc_resque.redis.database');
if ($redisHost != null && $redisPort != null) {
$env['REDIS_BACKEND'] = $redisHost.':'.$redisPort;
}
View
12 Command/StartWorkerCommand.php
@@ -25,13 +25,13 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$env = array(
- 'APP_INCLUDE' => $this->getContainer()->getParameter('bcc_resque.resque.vendor_dir').'/autoload.php',
+ 'APP_INCLUDE' => $this->getContainer()->getParameter('bcc_resque.vendor_dir').'/autoload.php',
'QUEUE' => $input->getArgument('queues'),
'VERBOSE' => 1,
);
$prefix = $this->getContainer()->getParameter('bcc_resque.prefix');
if (!empty($prefix)) {
- $env['PREFIX'] = $this->getContainer()->getParameter('bcc_resque.prefix');
+ $env['PREFIX'] = $prefix;
}
if ($input->getOption('verbose')) {
$env['VVERBOSE'] = 1;
@@ -40,9 +40,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
unset($env['VERBOSE']);
}
- $redisHost = $this->getContainer()->getParameter('bcc_resque.resque.redis.host');
- $redisPort = $this->getContainer()->getParameter('bcc_resque.resque.redis.port');
- $redisDatabase = $this->getContainer()->getParameter('bcc_resque.resque.redis.database');
+ $redisHost = $this->getContainer()->getParameter('bcc_resque.redis.host');
+ $redisPort = $this->getContainer()->getParameter('bcc_resque.redis.port');
+ $redisDatabase = $this->getContainer()->getParameter('bcc_resque.redis.database');
if ($redisHost != null && $redisPort != null) {
$env['REDIS_BACKEND'] = $redisHost.':'.$redisPort;
}
@@ -56,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
$workerCommand = strtr('php %opt% %dir%/chrisboulton/php-resque/resque.php', array(
'%opt%' => $opt,
- '%dir%' => $this->getContainer()->getParameter('bcc_resque.resque.vendor_dir'),
+ '%dir%' => $this->getContainer()->getParameter('bcc_resque.vendor_dir'),
));
if (!$input->getOption('foreground')) {
Something went wrong with that request. Please try again.