Skip to content

Instantly share code, notes, and snippets.

@SocalNick
Created June 4, 2013 00:10
Show Gist options
  • Save SocalNick/5702575 to your computer and use it in GitHub Desktop.
Save SocalNick/5702575 to your computer and use it in GitHub Desktop.
Clockwork + IronMQ
require 'clockwork'
require 'iron_mq'
module Clockwork
configure do |cofig|
config[:tz] = "America/Los_Angeles"
end
handler do |job|
ironmq = IronMQ::Client.new
queue = ironmq.queue("query-stat-provider")
queue.post(job)
end
every(5.seconds, '{"type":"clock","function":"getInprogressEvents"}')
every(1.minutes, '{"type":"clock","function":"getUpcomingEvents"}')
every(15.minutes, '{"type":"clock","function":"getUberUpdate"}')
every(1.day, '{"type":"clock","function":"getDaily"}', :at => '00:00')
end
@sullimander
Copy link

you could init this way

def ironmq
  @ironmq ||= IronMQ::Client.new
end

Then remove line #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment