0

I have been using clockwork to run custom delayed jobs after every 6 minutes. I am planning on trying whenever gem instead of clockwork. Does any one have an idea how should I go about doing this with whenever gem:

 Delayed::Job.enqueue(DelayedRake.new("contact:new"),priority:1,run_at: Time.now)

With clockwork I was doing it like this

every(1.hour, 'Fetching New Contacts',at: '**:01') { Delayed::Job.enqueue(DelayedRake.new("contact:new"),priority:1,run_at: Time.now) }

With clockwork gem it was working perfect. We are moving our application to EC2 from Heroku and I do not want to use clockwork on our Amazon EC2 instance.

Any help in resolving this would be highly apprecaited.

Smoke
  • 1,052
  • 1
  • 10
  • 24

1 Answers1

0

This is how it should be done :

every 1.hour, at: 1 do
 runner 'Delayed::Job.enqueue(DelayedRake.new("contact:new"),priority:1,run_at: Time.now)'
end

Works like a charm. Here is the link to github issue: Custom Jobs of delayed_job with Whenever.

Smoke
  • 1,052
  • 1
  • 10
  • 24