diff --git a/lib/kue.js b/lib/kue.js index 533bf20c..40a6758f 100755 --- a/lib/kue.js +++ b/lib/kue.js @@ -299,7 +299,10 @@ Queue.prototype.watchStuckJobs = function( ms ) { } this.stuck_job_watch = setInterval(function() { client.evalsha(sha, 0, function( err, fixes ) { - if( err ) return clearInterval(this.stuck_job_watch); + if( err ) { + self.emit('error', err); + return clearInterval(this.stuck_job_watch); + } }.bind(this)); }.bind(this), ms); diff --git a/lib/redis.js b/lib/redis.js index a77ff9ba..e852bb50 100755 --- a/lib/redis.js +++ b/lib/redis.js @@ -22,6 +22,12 @@ var url = require('url'); exports.configureFactory = function( options, queue ) { options.prefix = options.prefix || 'q'; + // make sure the prefix of the queue doesnt contain special characters + var pattern = /^[a-z0-9]+$/i + if (!pattern.test(options.prefix)) { + throw new Error('kue prefix string must be alphanumeric'); + } + if( typeof options.redis === 'string' ) { // parse the url var conn_info = url.parse(options.redis, true /* parse query string */);