Permalink
Browse files

Fix redis client connection settings

  • Loading branch information...
1 parent 84c6ce5 commit e5763806404bea37883f468a570325f1ea869a47 @behrad behrad committed Feb 18, 2014
Showing with 15 additions and 4 deletions.
  1. +4 −1 Readme.md
  2. +8 −2 lib/kue.js
  3. +3 −1 test/test.js
View
@@ -249,6 +249,8 @@ jobs.process('slideshow pdf', 5, function(job, done){
or mark the active job `failed` with shutdown error reason. When all workers tell Kue they are stopped `fn` is called.
```javascript
+var queue = require('kue').createQueue();
+
process.once( 'SIGTERM', function ( sig ) {
queue.shutdown(function(err) {
console.log( 'Kue is shut down.', err||'' );
@@ -267,7 +269,8 @@ process.once( 'SIGTERM', function ( sig ) {
q = kue.createQueue({
redis: {
port: 1234,
- host: '10.0.50.20'
+ host: '10.0.50.20',
+ auth: 'password',
options: {
// look for more redis options in [node_redis](https://github.com/mranney/node_redis)
}
View
@@ -24,7 +24,7 @@ exports = module.exports = Queue;
* Library version.
*/
-exports.version = '0.7.4';
+exports.version = require('../package.json').version;
/**
* Expose `Job`.
@@ -86,7 +86,13 @@ function Queue( options ) {
if( options.redis ){
redis.createClient = function() {
// redis.debug_mode = true;
- return require('redis').createClient( options.redis );
+ var port = options.redis.port || 6379;
+ var host = options.redis.host || '127.0.0.1';
+ var client = require('redis').createClient( port , host, options.redis.options );
+ if (options.redis.auth) {
+ client.auth(options.redis.auth);
+ }
+ return client;
};
}
this.client = redis.createClient();
View
@@ -1,5 +1,6 @@
var kue = require('../'),
jobs = kue.createQueue();
+
jobs.promote(1);
describe('Jobs', function () {
@@ -15,12 +16,13 @@ describe('Jobs', function () {
it('should be processed', function (done) {
var jobData = {
title: 'welcome email for tj',
- to: 'tj@learnboost.com',
+ to: '"TJ" <tj@learnboost.com>',
template: 'welcome-email'
};
jobs.create('email-should-be-processed', jobData).priority('high').save();
jobs.process('email-should-be-processed', function (job, jdone) {
job.data.should.be.eql(jobData);
+ job.log( '<p>This is <span style="color: green;">a</span> formatted log<p/>' );
jdone();
done();
});

0 comments on commit e576380

Please sign in to comment.