Sha256: 5f2483b8988b083e1c4eeadccaf0fcf4811efa5f3944cb0bb4aa5b1b37813dcf
Contents?: true
Size: 1.01 KB
Versions: 14
Compression:
Stored size: 1.01 KB
Contents
namespace :qc_plus do desc "Start a new worker for the (default or $QUEUE) queue" task :work => :environment do puts "Starting up worker for queue #{ENV['QUEUE']}" # ActiveRecord::RecordNotFound is ignored by Sentry by default, # which shouldn't happen in background jobs. if defined?(Sentry) Sentry.init do |config| config.excluded_exceptions = [] config.background_worker_threads = 0 if Gem::Version.new(Sentry::VERSION) >= Gem::Version.new('4.1.0') end elsif defined?(Raven) Raven.configure do |config| config.excluded_exceptions = [] end end @worker = QueueClassicPlus::CustomWorker.new trap('INT') do $stderr.puts("Received INT. Shutting down.") if !@worker.running $stderr.puts("Worker has already stopped running.") end @worker.stop end trap('TERM') do $stderr.puts("Received Term. Shutting down.") @worker.stop end @worker.start $stderr.puts 'Shut down successfully' end end
Version data entries
14 entries across 14 versions & 1 rubygems