Skip to content

bin/resque: add support for connecting with a cluster client #59

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

Closed
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ Alternately, you can always `include('bin/resque')` from your application and
skip setting `APP_INCLUDE` altogether. Just be sure the various environment
variables are set (`setenv`) before you do.

### Clustering support

Clustering support is automatically enabled when the `REDIS_BACKEND` environment
variable contains a comma separated list of hostnames
(`10.0.0.1:6379,10.0.0.2:6379`).

### Logging

The port supports the same environment variables for logging to STDOUT. Setting
Expand Down
16 changes: 11 additions & 5 deletions bin/resque
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,17 @@ $REDIS_BACKEND = getenv('REDIS_BACKEND');

// A redis database number
$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);
Comment on lines -43 to -47
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resque-scheduler has the same block, so support should probably also be added there


if (!empty($REDIS_BACKEND)) {
if (empty($REDIS_BACKEND_DB)) {
if (stripos($REDIS_BACKEND, ',') !== false) {
Resque::setBackend(explode(",", $REDIS_BACKEND));
} else {
Resque::setBackend($REDIS_BACKEND);
}
} else {
Resque::setBackend($REDIS_BACKEND, $REDIS_BACKEND_DB);
}
}

$logLevel = false;
Expand Down