Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cancel and/or dequeue jobs #303

Open
nicooga opened this issue Feb 27, 2018 · 0 comments
Open

Feature: cancel and/or dequeue jobs #303

nicooga opened this issue Feb 27, 2018 · 0 comments

Comments

@nicooga
Copy link

nicooga commented Feb 27, 2018

I need a job to run once X time after the last occurrence of an repeating event.

For example, In UI and game development I've seen this behavior when a user hits a button a something happens only N seconds after the last hit. Any other hit before N seconds cancels the old timer and sets a new one.

To put you in context, my site is an e-commerce and I need to implement a feature where 30min or so after the last time the user seen a page (a pageview in analytics terms), a marketing email is sent to they.

The way I solved this with Ruby and Sidekiq was running this algorithm each time a pageview event for a n user is created:

if (is there an associated job ID for this user?) {
  cancel that job
}

schedule a job to send the email 30 minutes from now
associate the ID for the job I've just created with this user

TL;DR: I need a way to dequeue jobs.

I see there is a dequeue function in Exq.Redis.JobQueue. There is no interface in Exq.Enqueuer.EnqueueApi to use it though. Is there a particular reason not to expose this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant