-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
43 lines (27 loc) · 726 Bytes
/
client.js
File metadata and controls
43 lines (27 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//CLIENT
var
kue = require('kue'),
jobs = kue.createQueue(),
Job = kue.Job;
var urls = ["http://jeveloper.com","https://google.com","http://news.ycombinator.com"]
key=0; while (key<urls.length){
url = urls[key];
console.log (" URL IS %s",url);
jobs.create('preview_url', {
// Title will show up in UI
title: url,
url: url
}).priority('normal').attempts(3).save();
key++;
}
jobs.on('job complete', function(id){
Job.get(id, function(err, job){
if (err) return;
//CLEANUP
job.data = {};
job.remove(function(err){
if (err) throw err;
console.log('removed completed job #%d , on %s', job.id, new Date());
});
});
});