public
Created

script for direct puting job into queue(sidekiq) w/o loading rails

  • Download Gist
enqueue.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#!/usr/bin/env ruby
begin
require 'sidekiq'
require 'honeybadger'
require File.expand_path(File.dirname(__FILE__)+"/../app/workers/base_worker")
Dir[File.dirname(__FILE__)+"/../app/workers/**/**"].each {|file| require File.expand_path(File.dirname(__FILE__)+file) }
 
worker = ARGV[0]
arg = ARGV[1]
 
if arg
p Object.const_get(worker).perform_async(arg)
else
p Object.const_get(worker).perform_async()
end
rescue =>e
Honeybadger.configure do |config|
config.api_key = 'some key'
config.environment_name = ENV["RAILS_ENV"]
config.ignore_only = []
end
 
Honeybadger.notify_or_ignore(e, {
:component => 'queue.rb',
:parameters => {args: ARGV}
})
p e.message
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.