Created
December 12, 2014 05:15
-
-
Save GeoffreyPlitt/a1b8866c982817c97dfb to your computer and use it in GitHub Desktop.
Kue with fake_redis
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 fake_redis = require("fakeredis"); | |
var QUEUE_NAME = 'incoming_mturk_events'; | |
var concurrency = 1; | |
var max_size = 10; | |
var kue = require('kue'); | |
var in_memory_queue = kue.createQueue({ | |
redis: { | |
createClientFactory: function(){ | |
return fake_redis.createClient('my_fake_redis'); | |
} | |
} | |
}); | |
in_memory_queue.process(QUEUE_NAME, concurrency, function(job, done) { | |
setTimeout(function(){ | |
console.log('gp1', job.data); | |
done(); | |
}, 1000); | |
}); | |
in_memory_queue.create(QUEUE_NAME, {a:1}).save(function(err){if(err) console.log(err);}); | |
in_memory_queue.create(QUEUE_NAME, {a:2}).save(function(err){if(err) console.log(err);}); | |
in_memory_queue.create(QUEUE_NAME, {a:3}).save(function(err){if(err) console.log(err);}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment