Skip to content

Commit 356a314

Browse files
committed
bump to 0.7.0
1 parent 5c43477 commit 356a314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3574
-1186
lines changed

.gitignore

100644100755
File mode changed.

.npmignore

100644100755
File mode changed.

.travis.yml

100644100755
File mode changed.

History.md

100644100755
File mode changed.

Makefile

100644100755
+19-19
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@ REPORTER = spec
33
all: build
44

55
build:
6-
@./node_modules/coffee-script/bin/coffee \
7-
-c \
8-
-o lib src
6+
@./node_modules/coffee-script/bin/coffee \
7+
-c \
8+
-o lib src
99

1010
test-tdd:
11-
@./node_modules/.bin/mocha \
12-
--reporter $(REPORTER) \
13-
--ui tdd \
14-
test/tdd/*.js
11+
@./node_modules/.bin/mocha \
12+
--reporter $(REPORTER) \
13+
--ui tdd \
14+
test/tdd/*.js
1515

1616
test-bdd:
17-
@./node_modules/.bin/mocha \
18-
--reporter $(REPORTER) \
19-
--require should \
20-
--ui bdd \
21-
test/*.js
17+
@./node_modules/.bin/mocha \
18+
--reporter $(REPORTER) \
19+
--require should \
20+
--ui bdd \
21+
test/*.js
2222

2323
test-bdd-coffee:
24-
@./node_modules/.bin/mocha \
25-
--compilers coffee:coffee-script \
26-
--reporter $(REPORTER) \
27-
--require should \
28-
--ui bdd \
29-
test/*.coffee
24+
@./node_modules/.bin/mocha \
25+
--compilers coffee:coffee-script \
26+
--reporter $(REPORTER) \
27+
--require should \
28+
--ui bdd \
29+
test/*.coffee
3030

3131

3232
test-all: test-bdd test-tdd test-bdd-coffee
3333

34-
.PHONY: test-all
34+
.PHONY: test-all

Readme.md

100644100755
File mode changed.

examples/delayed.js

100644100755
+14-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
var kue = require('../');
32

43
// create our job queue
@@ -10,36 +9,32 @@ var jobs = kue.createQueue();
109
var minute = 60000;
1110

1211
var email = jobs.create('email', {
13-
title: 'Account renewal required'
14-
, to: 'tj@learnboost.com'
15-
, template: 'renewal-email'
12+
title: 'Account renewal required', to: 'tj@learnboost.com', template: 'renewal-email'
1613
}).delay(minute)
17-
.priority('high')
18-
.save();
14+
.priority('high')
15+
.save();
1916

2017

21-
email.on('promotion', function(){
22-
console.log('renewal job promoted');
18+
email.on('promotion', function () {
19+
console.log('renewal job promoted');
2320
});
2421

25-
email.on('complete', function(){
26-
console.log('renewal job completed');
22+
email.on('complete', function () {
23+
console.log('renewal job completed');
2724
});
2825

2926
jobs.create('email', {
30-
title: 'Account expired'
31-
, to: 'tj@learnboost.com'
32-
, template: 'expired-email'
27+
title: 'Account expired', to: 'tj@learnboost.com', template: 'expired-email'
3328
}).delay(minute * 10)
34-
.priority('high')
35-
.save();
29+
.priority('high')
30+
.save();
3631

3732
jobs.promote();
3833

39-
jobs.process('email', 10, function(job, done){
40-
setTimeout(function(){
41-
done();
42-
}, Math.random() * 5000);
34+
jobs.process('email', 10, function (job, done) {
35+
setTimeout(function () {
36+
done();
37+
}, Math.random() * 5000);
4338
});
4439

4540
// start the UI

examples/events.js

100644100755
+32-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
var kue = require('../');
32

43
// create our job queue
@@ -13,49 +12,47 @@ var jobs = kue.createQueue();
1312
// user input etc.
1413

1514
function create() {
16-
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
17-
var job = jobs.create('video conversion', {
18-
title: 'converting ' + name + '\'s to avi'
19-
, user: 1
20-
, frames: 200
21-
});
22-
23-
job.on('complete', function(){
24-
console.log(" Job complete");
25-
}).on('failed', function(){
26-
console.log(" Job failed");
27-
}).on('progress', function(progress){
28-
process.stdout.write('\r job #' + job.id + ' ' + progress + '% complete');
29-
});
30-
31-
job.save();
32-
33-
setTimeout(create, Math.random() * 2000 | 0);
15+
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
16+
var job = jobs.create('video conversion', {
17+
title: 'converting ' + name + '\'s to avi', user: 1, frames: 200
18+
});
19+
20+
job.on('complete',function () {
21+
console.log(" Job complete");
22+
}).on('failed',function () {
23+
console.log(" Job failed");
24+
}).on('progress', function (progress) {
25+
process.stdout.write('\r job #' + job.id + ' ' + progress + '% complete');
26+
});
27+
28+
job.save();
29+
30+
setTimeout(create, Math.random() * 2000 | 0);
3431
}
3532

3633
create();
3734

3835
// process video conversion jobs, 1 at a time.
3936

40-
jobs.process('video conversion', 1, function(job, done){
41-
var frames = job.data.frames;
42-
43-
function next(i) {
44-
// pretend we are doing some work
45-
convertFrame(i, function(err){
46-
if (err) return done(err);
47-
// report progress, i/frames complete
48-
job.progress(i, frames);
49-
if (i >= frames) done()
50-
else next(i + Math.random() * 10);
51-
});
52-
}
53-
54-
next(0);
37+
jobs.process('video conversion', 1, function (job, done) {
38+
var frames = job.data.frames;
39+
40+
function next(i) {
41+
// pretend we are doing some work
42+
convertFrame(i, function (err) {
43+
if (err) return done(err);
44+
// report progress, i/frames complete
45+
job.progress(i, frames);
46+
if (i >= frames) done()
47+
else next(i + Math.random() * 10);
48+
});
49+
}
50+
51+
next(0);
5552
});
5653

5754
function convertFrame(i, fn) {
58-
setTimeout(fn, Math.random() * 50);
55+
setTimeout(fn, Math.random() * 50);
5956
}
6057

6158
// start the UI

examples/many.js

100644100755
+17-21
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
1-
21
var kue = require('../')
3-
, express = require('express');
2+
, express = require('express');
43

54
// create our job queue
65

76
var jobs = kue.createQueue();
87

98
function create() {
10-
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
11-
jobs.create('video conversion', {
12-
title: 'converting ' + name + '\'s to avi'
13-
, user: 1
14-
, frames: 200
15-
}).save();
16-
setTimeout(create, Math.random() * 3000 | 0);
9+
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
10+
jobs.create('video conversion', {
11+
title: 'converting ' + name + '\'s to avi', user: 1, frames: 200
12+
}).save();
13+
setTimeout(create, Math.random() * 3000 | 0);
1714
}
1815

1916
create();
2017

2118
function create2() {
22-
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
23-
jobs.create('email', {
24-
title: 'emailing ' + name + ''
25-
, body: 'hello'
26-
}).save();
27-
setTimeout(create2, Math.random() * 1000 | 0);
19+
var name = ['tobi', 'loki', 'jane', 'manny'][Math.random() * 4 | 0];
20+
jobs.create('email', {
21+
title: 'emailing ' + name + '', body: 'hello'
22+
}).save();
23+
setTimeout(create2, Math.random() * 1000 | 0);
2824
}
2925

3026
create2();
3127

3228
// process video conversion jobs, 3 at a time.
3329

34-
jobs.process('video conversion', 2, function(job, done){
35-
console.log('video');
36-
setTimeout(done, Math.random() * 5000);
30+
jobs.process('video conversion', 2, function (job, done) {
31+
console.log('video');
32+
setTimeout(done, Math.random() * 5000);
3733
});
3834

3935
// process 10 emails at a time
4036

41-
jobs.process('email', 10, function(job, done){
42-
console.log('email');
43-
setTimeout(done, Math.random() * 2000);
37+
jobs.process('email', 10, function (job, done) {
38+
console.log('email');
39+
setTimeout(done, Math.random() * 2000);
4440
});
4541

4642
// start the UI

examples/shutdown.js

100644100755
+18-19
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
21
var kue = require('../')
32

43
var jobs = kue.createQueue()
54

65

76
function generateJobs() {
8-
for (var i=0; i<12; i++) {
9-
console.log('Creating Job #' + i);
10-
jobs.create('long render', {
11-
title: 'rendering frame #' + i
12-
}).save();
13-
}
7+
for (var i = 0; i < 12; i++) {
8+
console.log('Creating Job #' + i);
9+
jobs.create('long render', {
10+
title: 'rendering frame #' + i
11+
}).save();
12+
}
1413
}
1514

1615

17-
jobs.process('long render', 4, function(job, done) {
18-
console.log('Starting ' + job.data.title);
19-
setTimeout(function() {
20-
console.log('Finished ' + job.data.title);
21-
done();
22-
}, 3000);
16+
jobs.process('long render', 4, function (job, done) {
17+
console.log('Starting ' + job.data.title);
18+
setTimeout(function () {
19+
console.log('Finished ' + job.data.title);
20+
done();
21+
}, 3000);
2322
})
2423

2524

2625
generateJobs();
2726

28-
setTimeout(function() {
29-
console.log('[ Shutting down when all jobs finish... ]');
30-
jobs.shutdown(function(err) {
31-
console.log('[ All jobs finished. Kue is shut down. ]');
32-
process.exit(0);
33-
})
27+
setTimeout(function () {
28+
console.log('[ Shutting down when all jobs finish... ]');
29+
jobs.shutdown(function (err) {
30+
console.log('[ All jobs finished. Kue is shut down. ]');
31+
process.exit(0);
32+
})
3433
}, 4200)
3534

0 commit comments

Comments
 (0)