Skip to content

Commit

Permalink
[ depend on github.com/mranney/node_redis ]
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Rothstein committed Oct 2, 2010
1 parent 952c47c commit 9df1e07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions bin/node-resque-worker
Expand Up @@ -33,6 +33,7 @@ if (process.env.NODE_DEBUG)

var resque = require ('../lib/resque')
.connect (options)
var resque = require ('resque').connect (options)

resque.cleanStaleWorkers ()

Expand Down
16 changes: 10 additions & 6 deletions lib/resque.js
@@ -1,6 +1,6 @@
var resque = exports
var EventEmitter = require ('events').EventEmitter
var sys = require ('sys')
var sys = require ('sys')

var processAlive = function (pid, cb) {
require('child_process').exec (
Expand All @@ -11,12 +11,16 @@ var processAlive = function (pid, cb) {
)
}

var connectToRedis = function (options) {
return require ('redis').createClient (options.port, options.host)
}


resque.connect = function (options) {
var options = options || {}
var redis = options.redis ||
require ('redis-client').createClient (options.port, options.host)
var namespace = options.namespace || 'resque'
var connection = {redis: redis, namespace: namespace}
var options = options || {}
var redis = options.redis || connectToRedis(options)
var namespace = options.namespace || 'resque'
var connection = { redis: redis, namespace: namespace }

var key = function () {
var args = Array.prototype.slice.apply (arguments)
Expand Down
9 changes: 3 additions & 6 deletions package.json
@@ -1,5 +1,5 @@
{ "name": "resque"
, "version": "0.0.2"
, "version": "0.0.3"
, "keywords": [ "redis", "resque", "worker", "queue"]
, "description": "resque (a redis-backed work queue) for node"
, "contributors":
Expand All @@ -11,10 +11,7 @@
, "url": "http://github.com/jbr/node-resque.git"
}
, "bugs": { "web": "http://github.com/jbr/node-resque/issues" }
, "directories":
{ "lib": "./lib"
, "test": "./bin"
}
, "dependencies": { "redis-client": ">= 0.3.4" }
, "dependencies": { "redis": ">= 0.3.2" }
, "main": "./lib/resque"
, "bin": { "node-resque-worker": "./bin/node-resque-worker" }
}

0 comments on commit 9df1e07

Please sign in to comment.