class Dynflow::Config
Public Class Methods
config_attr(name, *types, &default)
click to toggle source
# File lib/dynflow/config.rb, line 7 def self.config_attr(name, *types, &default) self.send(:define_method, "validate_#{ name }!") do |value| Type! value, *types unless types.empty? end self.send(:define_method, name) do var_name = "@#{ name }" if instance_variable_defined?(var_name) return instance_variable_get(var_name) else return default end end self.send(:attr_writer, name) end
Public Instance Methods
queues()
click to toggle source
# File lib/dynflow/config.rb, line 76 def queues @queues ||= QueuesConfig.new end
validate(config_for_world)
click to toggle source
# File lib/dynflow/config.rb, line 189 def validate(config_for_world) if defined? ::ActiveRecord::Base begin ar_pool_size = ::ActiveRecord::Base.connection_pool.instance_variable_get(:@size) if (config_for_world.pool_size / 2.0) > ar_pool_size config_for_world.world.logger.warn 'Consider increasing ActiveRecord::Base.connection_pool size, ' + "it's #{ar_pool_size} but there is #{config_for_world.pool_size} " + 'threads in Dynflow pool.' end rescue ActiveRecord::ConnectionNotEstablished # rubocop:disable Lint/HandleExceptions # If in tests or in an environment where ActiveRecord doesn't have a # real DB connection, we want to skip AR configuration altogether end end end