Sunday 26 November 2017

Ideas for settings up and manipulating a queue system

For an small project I'm working on, I need to set up a queue system and rather than trial and error all the ideas I've had for doing it, I thought I'd ask for ideas. My stack is relatively simple. Node, Express, PUG view engine, MongoDB + MongooseAn application that might function similar to what I'm looking for would be like an email queue. You can add a new email to the queue, edit an email that's already in the queue, and re-order emails that are in the queue. Then a cron job would be scheduled to send out the next email in the queue. Again, I'm just looking for ideas about how to manage and persist the queue order.Currently, my best idea is to simple start a new DB collection with a single record. It would be an array of ID's, and it's order would be the order in which the queue would function. I could add a new item to the queue, and add it's ID to the array, move IDs within the array around to re-order the queue... etc....Anyone ever done something like this before?

Submitted November 26, 2017 at 10:52PM by SableElephant

No comments:

Post a Comment