Created
December 14, 2012 15:18
-
-
Save teiikushi07/4286198 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//兩邊都一樣 | |
var kue = require('kue'); | |
var redis = require('redis'); | |
kue.redis.createClient = function() { | |
var client = redis.createClient(port, host); | |
client.auth(password); | |
return client; | |
}; | |
var jobs = kue.createQueue(); | |
//---------------------------------------------------------------------------------------------- | |
//web | |
function createJob(mobile, verifyCode){ | |
jobs.create('invoice', { | |
title: 'load '+mobile | |
, mobile: mobile | |
, verifyCode: mobile | |
}).save(); | |
} | |
//---------------------------------------------------------------------------------------------- | |
//worker | |
jobs.process('invoice', function(job, done){ | |
console.log('---------load invoice------------------'); | |
setTimeout(done, 1000); | |
}); | |
// start the UI | |
kue.app.listen(3000); | |
console.log('UI started on port 3000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment