File tree Expand file tree Collapse file tree 1 file changed +16
-13
lines changed
Expand file tree Collapse file tree 1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -124,22 +124,25 @@ def increase_db_pool_size(world = nil)
124124 warn 'Deprecated: using `increase_db_pool_size` outside of Dynflow code is not needed anymore'
125125 return
126126 end
127- if increase_db_pool_size?
128- db_pool_size = calculate_db_pool_size ( world )
129127
130- base_config = ::ActiveRecord ::Base . configurations . configs_for ( env_name : ::Rails . env ) [ 0 ]
131- config = if base_config . respond_to? ( :configuration_hash )
132- ::Dynflow ::Utils ::IndifferentHash . new ( base_config . configuration_hash . dup )
133- else
134- base_config . config . dup
135- end
128+ return unless increase_db_pool_size?
136129
137- return unless config [ 'pool' ] . to_i < db_pool_size
130+ db_pool_size = calculate_db_pool_size ( world )
138131
139- config [ 'pool' ] = db_pool_size
140- ::ActiveRecord ::Base . connection_pool . disconnect!
141- ::ActiveRecord ::Base . establish_connection ( config )
142- end
132+ base_config = ::ActiveRecord ::Base . configurations . configs_for ( env_name : ::Rails . env ) [ 0 ]
133+ config = if base_config . respond_to? ( :configuration_hash )
134+ ::Dynflow ::Utils ::IndifferentHash . new ( base_config . configuration_hash . dup )
135+ else
136+ base_config . config . dup
137+ end
138+
139+ return unless config [ 'pool' ] . to_i < db_pool_size
140+
141+ dynflow_logger . warn "Increasing database pool connections from #{ config [ 'pool' ] } to #{ db_pool_size } "
142+
143+ config [ 'pool' ] = db_pool_size
144+ ::ActiveRecord ::Base . connection_pool . disconnect!
145+ ::ActiveRecord ::Base . establish_connection ( config )
143146 end
144147
145148 # generates the options hash consumable by the Dynflow's world
You can’t perform that action at this time.
0 commit comments