Josh Brody
Josh Brody

Reputation: 5363

Rails gem to manage queue and delayed outcomes

For our app we're setting up something like this:

We have multiple tasks that are in a queue (read from the database, nothing special here) that are to be done by each user. Once the user completes the task, they're asked what the outcome was. Each outcome has its own set of rules. The rules look like so:

Will delayed_jobs be able to handle this? I'm using a pg database if it matters any.

Upvotes: 0

Views: 156

Answers (1)

CubaLibre
CubaLibre

Reputation: 1703

A quick look up on the Github homepage for DelayedJob yielded this! Looks like you can easily schedule something to happen at a particular future time:

  def follow_up
    # Some other code
  end
  # 12.minutes.from_now will be evaluated when follow_up is called

  handle_asynchronously :follow_up, :run_at => Proc.new { 12.days.from_now }

Upvotes: 2

Related Questions