For example I enqueued a job as so
Resque.enqueue(MyJob, user.id)
Before en-queueing another job with the same user.id
I would like to check if there already exists a job with that user id in the queue.
I hope there is some syntax like:
Resque.queue('MyQueue').has_pending_job(MyJob, user.id)
I don't think there's such thing, you can achieve the same with multiple options
You can have the has_pending_jobs
attribute in the user, update it to true when the job starts and false when it ends
use the resque-status
extension https://github.com/quirkey/resque-status to keep track of the job_ids
that are en queued for a certain user
use separate queue for each user (this isn't scalable) and check if there's something in the queue for the user or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With