move sidekiq configuration from initializer to sidekiq.yml
This commit is contained in:
parent
4f8cf0fe07
commit
c5bc495f3f
3 changed files with 30 additions and 29 deletions
|
|
@ -11,31 +11,9 @@ if AppConfig.environment.single_process_mode? && Rails.env != "test"
|
|||
require 'sidekiq/testing/inline'
|
||||
end
|
||||
|
||||
def (Sidekiq::Logging).logger
|
||||
defined?(@logger) ? @logger : (AppConfig.heroku? ? initialize_logger : initialize_logger(AppConfig.sidekiq_log))
|
||||
end
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = AppConfig.get_redis_options
|
||||
|
||||
config.options = config.options.merge({
|
||||
concurrency: AppConfig.environment.sidekiq.concurrency.to_i,
|
||||
queues: %w{
|
||||
socket_webfinger
|
||||
photos
|
||||
http_service
|
||||
dispatch
|
||||
mail
|
||||
delete_account
|
||||
receive_local
|
||||
receive
|
||||
receive_salmon
|
||||
http
|
||||
maintenance
|
||||
default
|
||||
}
|
||||
})
|
||||
|
||||
config.server_middleware do |chain|
|
||||
chain.add SidekiqMiddlewares::CleanAndShortBacktraces
|
||||
end
|
||||
|
|
@ -46,7 +24,7 @@ Sidekiq.configure_server do |config|
|
|||
ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}"
|
||||
ActiveRecord::Base.establish_connection
|
||||
end
|
||||
|
||||
|
||||
# Make sure each Sidekiq process has its own sequence of UUIDs
|
||||
UUID.generator.next_sequence
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
require 'pathname'
|
||||
require 'bundler/setup'
|
||||
require 'configurate'
|
||||
|
||||
rails_root = File.expand_path('../../', __FILE__)
|
||||
rails_env = ENV['RACK_ENV']
|
||||
rails_env ||= ENV['RAILS_ENV']
|
||||
rails_env ||= 'development'
|
||||
rails_env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
|
||||
|
||||
require File.join(rails_root, 'lib', 'configuration_methods')
|
||||
module Rails
|
||||
def self.root
|
||||
@__root ||= Pathname.new File.expand_path('../../', __FILE__)
|
||||
end
|
||||
end
|
||||
|
||||
config_dir = File.join rails_root, 'config'
|
||||
require Rails.root.join 'lib', 'configuration_methods'
|
||||
|
||||
config_dir = Rails.root.join('config').to_s
|
||||
|
||||
|
||||
AppConfig ||= Configurate::Settings.create do
|
||||
|
|
|
|||
18
config/sidekiq.yml
Normal file
18
config/sidekiq.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<% require_relative 'config/load_config' %>
|
||||
---
|
||||
:verbose: false
|
||||
:logfile: "<%= AppConfig.sidekiq_log unless AppConfig.heroku? %>"
|
||||
:concurrency: <%= AppConfig.environment.sidekiq.concurrency.to_i %>
|
||||
:queues:
|
||||
- socket_webfinger
|
||||
- photos
|
||||
- http_service
|
||||
- dispatch
|
||||
- mail
|
||||
- delete_account
|
||||
- receive_local
|
||||
- receive
|
||||
- receive_salmon
|
||||
- http
|
||||
- maintenance
|
||||
- default
|
||||
Loading…
Reference in a new issue