Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.46k stars 867 forks source link

Cancel particular tasks in queue #1143

Closed BestPractises2GO closed 6 years ago

BestPractises2GO commented 6 years ago

Hello community,

is it possible, to abort/finish/cancel a certain task in the "waiting queue"? My use-case is as follows:

I have a mongodb collection "users" and a collection "friendship" where I store name and avatar of both users. So I only need one query to get friendlist of a certain user. When a user changes his avatar, I have to update all documents within this user in "friendship" collection. This is a performance-uncritical operation since I want to do this update operation outside of req/res loop in background, consistency is not important for this use-case. But when a User updates his avatar several times in a short time span, I want to cancel all referencing old tasks (for updating the friendship collection) except the newest. Is this with kue possible?

Thanks in advance, I would appreciate every information about that.

Clan-Utility commented 6 years ago

How do you finally solve this?