Sidekiq had been processing jobs just fine (finished 30 jobs overnight). This morning, it completely shut off processing the queue (now up to 28 jobs).
Running on Heroku (1 Standard-2x Web Dyno, 1 Standard-1x Worker Dyno).
Procfile (where I have had the most trouble finding documentation to configure)
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -e production -C config/sidekiq.yml
sidekiq.yml
development:
:concurrency: 5
production:
:concurrency: 20
:queues:
- ["default", 1]
- ["mailers", 2]
sidekiq.rb
if Rails.env.production?
Sidekiq.configure_client do |config|
config.redis = { url: ENV['REDIS_URL'], size: 2 }
end
Sidekiq.configure_server do |config|
config.redis = { url: ENV['REDIS_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 # seconds
# config['pool'] = ENV['WORKER_DB_POOL_SIZE'] || Sidekiq.options[:concurrency]
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
end
Also, with all the jobs in the queue (default, mailers) is it possible to have Sidekiq force run the jobs?
UPDATE
I have narrowed the error to the Heroku worker. Upon restart, the worker quickly crashes.
The first error had to do with Sidekiq not spawning enough connections (Redis required 22, I had set the limit to 20).
Now, I am getting the following error:
Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I am running PG Hobby via Heroku. Its connection limit is 20. Is this the source of the issue?