I am working with a deferred task for an active gem entry https://github.com/collectiveidea/delayed_job I am trying to set up work five minutes after the event takes place in my application. Five minutes later I need to do some database updates. I tried rake: work and RAILS_ENV = development script / delayed_job start. Before that, I started a batch installation, the rails generated delayed_job: active_record and rake db: migrate. I have a lottery site that needs to check winners every five minutes and update tokens for winning players.
I wait five minutes, but no updates are made in my local application.
Here is what I still have:
Gem File:
gem 'delayed_job_active_record' gem "daemons"
Task (located in lib)
class WinnersJob < Struct.new(:blast_id) def perform ... end
Controller
require 'winners' Delayed::Job.enqueue(WinnersJob.new(blast.id), 1, 5.minutes.from_now) end
Brian source share