Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A very basic queue to allow downloading feeds #24

Merged
merged 2 commits into from
Nov 4, 2019

Conversation

humphd
Copy link
Contributor

@humphd humphd commented Nov 2, 2019

To get us started, I've taken a crack at writing a basic queue-based producer/consumer app, based on Bull (Bull on GitHub). Nothing in this PR is sacred, and it can all be changed, but I wanted to get us moving forward with a basic prototype people can hack on.

To run this, you need to have Redis installed (we'll need install docs added for Windows/Linux/macOS in other bugs and/or use Docker or something).

Next, you can start the server like so:

npm install
npm start

This will start the server, read the list of feed URLs in feeds.txt (just a few to get us something to test on), and convert them into jobs for the queue.

A worker will start watching for jobs to appear in the queue, and process them. At this point, all it does is download the feed from the URL and dump it to the console:


Enqueuing Job - https://neilong31.wordpress.com/feed/
Enqueuing Job - http://ajhooper.blogspot.com/feeds/posts/default
Enqueuing Job - http://ljubomirgorscak.blogspot.com/feeds/posts/default
Enqueuing Job - http://nashutzu.blogspot.com/feeds/posts/default
Enqueuing Job - http://nadavid.blogspot.com/feeds/posts/default
Enqueuing Job - http://gkrilov.blogspot.com/feeds/posts/default
Enqueuing Job - http://KrazyDre.blogspot.com/feeds/posts/default?alt=rss
Enqueuing Job - http://dcucereavii.blogspot.com/feeds/posts/default?alt=rss
Processing job - https://neilong31.wordpress.com/feed/
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
...
Processing job - http://ljubomirgorscak.blogspot.com/feeds/posts/default
<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-836232110780560036</id><updated>2018-03-05T07:42:13.203-08:00</updated><title type='text'>Ljubomir Gorscak&#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ljubomirgorscak.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/836232110780560036/posts/default'/><link rel='alternate' type='text/html' href='http://ljubomirgorscak.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ljubomir Gorscak</name><uri>http://www.blogger.com/profile/14461114932281198167</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='https://3.bp.blogspot.com/-MsMhSKZYgUM/U3zrziWaUPI/AAAAAAAABBM/GpQOoFbE4kY/s113/IMG_3604.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>0</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage></feed>
...

Once it processes all the jobs, it will sit and wait for more to arrive. Right now, none will, but we can restart the list after it completes.

Hopefully this will give people something to play with, and get you thinking about how to plug other things into the mix.

I'd like to merge this, but would appreciate a review before I do. Anyone able to do that for me?

src/index.js Outdated Show resolved Hide resolved
@Reza-Rajabi
Copy link
Contributor

Looks great.

Copy link
Contributor

@UltimaBGD UltimaBGD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing I'd want to talk about is the dependency ranges, but they would both be non major version updates which would likely not run into newer version problems so it likely doesn't matter much here.

@humphd humphd merged commit db0640a into Seneca-CDOT:master Nov 4, 2019
@Reza-Rajabi Reza-Rajabi added this to Done in Main Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Main
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants