lib/decent.js
function Queue(name, opts) {

	// allow call as function
	if (!(this instanceof Queue))
		return new Queue(name, opts);

	if (!name) {
		throw new Error('queue name is required');
	}

	opts = opts || {};

	// basic
	this.name = name;
	this.port = opts.port || 6379;
	this.host = opts.host || '127.0.0.1';

	// queue config
	this.config = {
		blockTimeout: opts.blockTimeout || 60
		, maxRetry: opts.maxRetry || 3
	};

	// redis options
	this.opts = opts;

	// main redis client
	this.client = Redis.createClient(this.port, this.host, this.opts);

	// client for blocking command only
	this.bclient = Redis.createClient(this.port, this.host, this.opts);

	// queue name
	this.prefix = 'dq:' + this.name;
	this.workQueue = this.prefix + ':work';
	this.runQueue = this.prefix + ':run';
	this.failQueue = this.prefix + ':fail';

	// status code
	this.status_timeout = 1;

	// queue status
	this.shutdown = false;
	this.running = false;

}
function Queue(name, opts) {

	// allow call as function
	if (!(this instanceof Queue))
		return new Queue(name, opts);

	if (!name) {
		throw new Error('queue name is required');
	}

	opts = opts || {};

	// basic
	this.name = name;
	this.port = opts.port || 6379;
	this.host = opts.host || '127.0.0.1';

	// queue config
	this.config = {
		blockTimeout: opts.blockTimeout || 60
		, maxRetry: opts.maxRetry || 3
	};

	// redis options
	this.opts = opts;

	// main redis client
	this.client = Redis.createClient(this.port, this.host, this.opts);

	// client for blocking command only
	this.bclient = Redis.createClient(this.port, this.host, this.opts);

	// queue name
	this.prefix = 'dq:' + this.name;
	this.workQueue = this.prefix + ':work';
	this.runQueue = this.prefix + ':run';
	this.failQueue = this.prefix + ':fail';

	// status code
	this.status_timeout = 1;

	// queue status
	this.shutdown = false;
	this.running = false;

}
function Queue ( name , opts ) { // allow call as function if ( ! ( this instanceof Queue ) ) return new Queue ( name , opts ) ; if ( ! name ) { throw new Error ( 'queue name is required' ) ; } opts = opts || { } ; // basic this . name = name ; this . port = opts . port || 6379 ; this . host = opts . host || '127.0.0.1' ; // queue config this . config = { blockTimeout : opts . blockTimeout || 60 , maxRetry : opts . maxRetry || 3 } ; // redis options this . opts = opts ; // main redis client this . client = Redis . createClient ( this . port , this . host , this . opts ) ; // client for blocking command only this . bclient = Redis . createClient ( this . port , this . host , this . opts ) ; // queue name this . prefix = 'dq:' + this . name ; this . workQueue = this . prefix + ':work' ; this . runQueue = this . prefix + ':run' ; this . failQueue = this . prefix + ':fail' ; // status code this . status_timeout = 1 ; // queue status this . shutdown = false ; this . running = false ; }
Create an instance of Queue

@param   String  name  Name of this queue
@param   Object  opts  Redis options
@return  Object
Create an instance of Queue