Skip to content

Commit

Permalink
Merge pull request #24 from humphd/bullmq
Browse files Browse the repository at this point in the history
A very basic queue to allow downloading feeds
  • Loading branch information
humphd committed Nov 4, 2019
2 parents 7ae61a7 + 1293ab6 commit db0640a
Show file tree
Hide file tree
Showing 6 changed files with 429 additions and 0 deletions.
10 changes: 10 additions & 0 deletions feeds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# A simple list of feeds for initial testing, copied from
# https://wiki.cdot.senecacollege.ca/wiki/Planet_CDOT_Feed_List
https://neilong31.wordpress.com/feed/
http://ajhooper.blogspot.com/feeds/posts/default
http://ljubomirgorscak.blogspot.com/feeds/posts/default
http://nashutzu.blogspot.com/feeds/posts/default
http://nadavid.blogspot.com/feeds/posts/default
http://gkrilov.blogspot.com/feeds/posts/default
http://KrazyDre.blogspot.com/feeds/posts/default?alt=rss
http://dcucereavii.blogspot.com/feeds/posts/default?alt=rss
333 changes: 333 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "telescope",
"version": "0.0.1",
"description": "A tool for tracking blogs in orbit around Seneca's open source involvement",
"scripts": {
"test": "echo \"TODO!\" && exit 1",
"start": "node src"
},
"repository": "Seneca-CDOT/telescope",
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/Seneca-CDOT/telescope/issues"
},
"homepage": "https://github.com/Seneca-CDOT/telescope#readme",
"dependencies": {
"bent": "^7.0.2",
"bull": "^3.11.0"
}
}
4 changes: 4 additions & 0 deletions src/feed-queue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const Bull = require('bull');
const queue = new Bull('feed-queue');

module.exports = queue;
14 changes: 14 additions & 0 deletions src/feed-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const feedQueue = require('./feed-queue');
const bent = require('bent');
const request = bent('string');

exports.start = function() {
// Start processing jobs from the feed queue...
feedQueue.process(async (job) => {
const { url } = job.data;
console.log(`Processing job - ${url}`);

// For now, just get the feed data and dump to the console
return request(url).then(data => console.log(data + '\n\n'))
});
};
Loading

0 comments on commit db0640a

Please sign in to comment.