Skip to content

Commit

Permalink
Create a more sane initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhenrixon committed Jan 22, 2021
1 parent 0fa7fe6 commit e5ed9d6
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions myapp/config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
retry: true,
}

Sidekiq.configure_client do |config|
config.client_middleware do |chain|
chain.add SidekiqUniqueJobs::Middleware::Client
end
end

Sidekiq.configure_client do |config|
config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }

Expand All @@ -38,21 +32,18 @@
end

SidekiqUniqueJobs::Server.configure(config)

config.error_handlers << ->(ex, ctx_hash) { p ex, ctx_hash }
end

Sidekiq.logger = Sidekiq::Logger.new($stdout)
Sidekiq.logger.level = :debug
Sidekiq.log_format = :json if Sidekiq.respond_to?(:log_format)
Sidekiq.log_format = :json if Sidekiq.respond_to?(:log_format)
SidekiqUniqueJobs.configure do |config|
config.debug_lua = true
config.lock_info = true
config.logger = Sidekiq.logger
config.max_history = 10_000
config.reaper = :lua
config.reaper_count = 100
config.reaper_interval = 10
config.reaper_timeout = 5
config.debug_lua = false # true for debugging
config.lock_info = false # true for debugging
config.max_history = 1000 # keeps n number of changelog entries
config.reaper = :ruby # also :lua but that will lock while cleaning
config.reaper_count = 1000 # Reap maximum this many orphaned locks
config.reaper_interval = 10 # Reap every 10 seconds
config.reaper_timeout = 5 # Give the reaper 5 seonds to finish
end
Dir[Rails.root.join("app", "workers", "**", "*.rb")].sort.each { |worker| require worker }

0 comments on commit e5ed9d6

Please # to comment.