The final project for the course asked me to make significant instead of small contributions to the open-source. After wandering in the open-source, I decided to work on telescope maintained by Seneca folks.
Understanding the issue:
The issue asks me to expose the feed queue maintained by Bull to post service.
It took me a while to understand roughly the file structure and how different modules work as this is my first time contributing.
I started off by reading the backend code especially any queue-related code. The backend uses Bull(to facilitate asynchronous behaviors) + Redis (ioredis) to manage the feed queue, it essentially parses blog posts from each feed (RSS feed url) and each parsing is a job to be added to the Bull queue.
Attempting to solve:
My idea is to create a new Bull queue client with the option createClient (to create new ioredis client connections) to be an ioredis instance connecting to the Redis database.
const Bull = require('bull');
const redis = require('./redis'); //ioredis instance from satellite
const queue = new Bull('feed-queue', {
createClient: redis,
});
module.exports = queue;
I also added a route to return the queue's job but the response was a very long loading screen. I've got to spend more time on figuring this out, maybe it is not the correct idea. I hope to solve this issue soon!
feeds.get('/info', async (req, res, next) => {
let jobNum;
try {
jobNum = await queue.count();
res.json({ jobNum });
} catch (err) {
logger.error({ err }, "Unable to get queue's info");
next(err);
}
});
Top comments (0)