Skip to content

Instantly share code, notes, and snippets.

@teiikushi07
Created December 14, 2012 15:18
Show Gist options
  • Save teiikushi07/4286198 to your computer and use it in GitHub Desktop.
Save teiikushi07/4286198 to your computer and use it in GitHub Desktop.
//兩邊都一樣
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