I use hero, puma, redis to go with sidekiq. when I try to do some background work that time throwsYour Redis connection pool is too small for Sidekiq to work. Your pool has 20 connections but really needs to have at least 22
Below are the configuration files, please help find a solution

I use
Redis To Go Instance: Mini
PROCFILE
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml
puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 1)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
before_fork do
puts "Puma master process about to fork. Closing existing Active record connections."
ActiveRecord::Base.connection.disconnect!
end
on_worker_boot do
ActiveRecord::Base.establish_connection
end
In sidekiq.yml
development:
:concurrency: 5
production:
:concurrency: 20
:queues:
- default
sidekiq.rb
Sidekiq.configure_client do |config|
config.redis = { url: ENV['REDISTOGO_URL'], size: 2 }
end
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDISTOGO_URL'], size: 20 }
Rails.application.config.after_initialize do
Rails.logger.info("DB Connection Pool size for Sidekiq Server before disconnect is: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}")
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DATABASE_REAP_FREQ'] || 10
config['pool'] = 16
ActiveRecord::Base.establish_connection(config)
Rails.logger.info("DB Connection Pool size for Sidekiq Server is now: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}")
end
end
end
After deploying this configuration, it throws below errors,
Your Redis connection pool is too small for Sidekiq to work. Your pool has 20 connections, but should actually be at least 22
I later updated the data below in the sidkiq.rb file,
Sidekiq.configure_client do |config|
config.redis = { url: ENV['REDISTOGO_URL'], size: 2 }
end
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDISTOGO_URL'], size: 22 }
Rails.application.config.after_initialize do
Rails.logger.info("DB Connection Pool size for Sidekiq Server before disconnect is: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}")
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = ENV['DATABASE_REAP_FREQ'] || 10
config['pool'] = 16
ActiveRecord::Base.establish_connection(config)
Rails.logger.info("DB Connection Pool size for Sidekiq Server is now: #{ActiveRecord::Base.connection.pool.instance_variable_get('@size')}")
end
end
end
This time he throws another problem that
The maximum number of ERR customers has reached
I only get this problem in production, please help me