This is not specified for any particular language or software, this is a question on design of queue. Imagine I have lots of time-consuming tasks in db. Now I put these tasks in the queue. In the meantime, users can add/pause/delete tasks. How do I reflect the change to the queue? I'm thinking about 2 ways:
- every time users make a change, change the db and queue at the same time.
- every time users make a change, only change the db, and let the queue retrieve the latest tasks periodically, then refresh all its tasks inside.
These 2 ways might not be the "best practice". I just want to see if there is better way of tackling this situation. Or any improvement on these 2 ways above will be great as well. Thanks!
Aucun commentaire:
Enregistrer un commentaire