Sha256: 9a436547908f937032fdf09304150a4d5144136223f01438fe10cb11f3c7ebd5
Contents?: true
Size: 1.62 KB
Versions: 7
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails gems # installed from the root of your application. APP_PATH = File.expand_path('../dummy_rails', __dir__) ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', __dir__) if File.exist?(ENV['BUNDLE_GEMFILE']) require 'bundler/setup' else raise ArgumentError, "ENV['BUNDLE_GEMFILE'] not found at [#{ENV['BUNDLE_GEMFILE']}]" end require 'sidekiq' require 'sidekiq/cli' def assign_configs! worker_files = Dir["#{APP_PATH}/app/workers/**/*_worker.rb"] bind_queues = worker_files.map { |path| File.basename(path, '.rb') } Sidekiq.configure_server do |config| options = { require: APP_PATH, environment: ENV['RAILS_ENV'] || 'development', queues: bind_queues.select { |c| !c.include?('exclude') }, strict: false, concurrency: 10, } config.options = config.options.merge(options) end end def integrate_with_systemd return unless ENV["NOTIFY_SOCKET"] Sidekiq.configure_server do |config| Sidekiq.logger.info "Enabling systemd notification integration" require "sidekiq/sd_notify" config.on(:startup) do Sidekiq::SdNotify.ready end config.on(:shutdown) do Sidekiq::SdNotify.stopping end Sidekiq.start_watchdog if Sidekiq::SdNotify.watchdog? end end begin cli = Sidekiq::CLI.instance assign_configs! cli.parse assign_configs! integrate_with_systemd cli.run rescue => e raise e if $DEBUG if Sidekiq.error_handlers.length == 0 STDERR.puts e.message STDERR.puts e.backtrace.join("\n") else cli.handle_exception e end exit 1 end
Version data entries
7 entries across 7 versions & 1 rubygems