add option to call process with type and callback only

This commit is contained in:
amiram
2017-06-14 16:55:16 +03:00
parent 39e8957bd0
commit 779dcecfa7
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export declare class Queue extends events.EventEmitter {
checkActiveJobTtl(ttlOptions: Object): void;
watchStuckJobs(ms: number): void;
setting(name: string, fn: Function): Queue;
process(type: string, n?: number, fn?: Function): void;
process(type: string, n?: number | Function, fn?: Function): void;
shutdown(timeout: number, type: string, fn: Function): Queue;
types(fn: Function): Queue;
state(string: string, fn: Function): Queue;
+6 -3
View File
@@ -46,7 +46,7 @@ create();
// process video conversion jobs, 1 at a time.
jobs.process('video conversion', 1, function(job: kue.Job, done: Function) {
var processCb = function(job: kue.Job, done: Function) {
var frames: number = job.data.frames;
function next(i: number) {
@@ -61,7 +61,10 @@ jobs.process('video conversion', 1, function(job: kue.Job, done: Function) {
}
next(0);
} );
}
jobs.process('video conversion', 1, processCb);
jobs.process('video conversion', processCb);
function convertFrame(i: number, fn: Function) {
setTimeout(fn, Math.random() * 50);
@@ -102,4 +105,4 @@ jobs.process('email', 10, function(job: kue.Job, done: Function) {
// start the UI
kue.app.listen(3000);
console.log('UI started on port 3000');
console.log('UI started on port 3000');