Skip to content

Instantly share code, notes, and snippets.

@rafalyesware
rafalyesware / sidekiq.rb
Created October 7, 2015 18:31 — forked from stevenharman/sidekiq.rb
The best solution I've found for reliably configuring Sidekiq's ActiveRecord connection pool size on Heroku.
# /config/initializers/sidekiq.rb
current_web_concurrency = Proc.new do
web_concurrency = ENV['WEB_CONCURRENCY']
web_concurrency ||= Puma.respond_to?
(:cli_config) && Puma.cli_config.options.fetch(:max_threads)
web_concurrency || 16
end
local_redis_url = Proc.new do