-
Notifications
You must be signed in to change notification settings - Fork 189
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
Feed Worker should store Posts in Redis when done #264
Comments
I can work on this one! |
@c3ho can I get you to do 1 Issue at a time? Right now you have 3 assigned to you, and other students will want a piece of the action, too. |
From @humphd When we "resolve" in the feed worker (or return if using async), we can get the result back using const feedQueue = require('./queue');
const feedParser = require('./parser');
const { logger } = require('../utils/logger');
exports.processor = async function(job) {
const { url } = job.data;
logger.info({ url }, 'Processing job');
let posts;
try {
posts = await feedParser(url);
} catch (err) {
logger.error({ err, url }, 'feed parser failed to parse url');
throw err;
}
return posts.map(post => ({
author: post.author,
date: post.date,
title: post.title,
description: post.description,
postURL: post.link,
}));
};
exports.start = function() {
// Start processing jobs from the feed queue...
logger.info('starting feed queue processing...');
feedQueue.process(exports.processor);
}; |
@c3ho I'm going to need this fix to land in the next day or so. Are you able to do it that quickly? If not, I'll need to take it from you. Let me know. We could also work on it in class tomorrow. |
I’ll be able to finish by tomorrow |
Awesome. Let's plan to work on reviewing and merging this in class in the morning. |
Our feed-worker.js currently parses Posts, puts them into an array, and console.logs them.
We need to use the work in #260 and #259, we need to update it so that a Post gets stored in the database. This depends on #260 for the changes to storage.js.
The text was updated successfully, but these errors were encountered: