diff --git a/lib/dynflow/rails.rb b/lib/dynflow/rails.rb index 3212e510..e976c465 100644 --- a/lib/dynflow/rails.rb +++ b/lib/dynflow/rails.rb @@ -38,8 +38,8 @@ def initialize! init_world.tap do |world| @world = world config.run_on_init_hooks(false, world) + config.increase_db_pool_size(world) unless config.remote? - config.increase_db_pool_size(world) config.run_on_init_hooks(true, world) # leave this just for long-running executors unless config.rake_task_with_executor? diff --git a/lib/dynflow/rails/configuration.rb b/lib/dynflow/rails/configuration.rb index 9cf7528d..1598536d 100644 --- a/lib/dynflow/rails/configuration.rb +++ b/lib/dynflow/rails/configuration.rb @@ -96,7 +96,11 @@ def rake_task_with_executor? end def increase_db_pool_size? - !::Rails.env.test? && !remote? + !::Rails.env.test? && (!remote? || sidekiq_worker?) + end + + def sidekiq_worker? + defined?(::Sidekiq) && ::Sidekiq.options[:queues].any? end def calculate_db_pool_size(world)