lib/foreman_tasks/dynflow/configuration.rb in foreman-tasks-0.8.6 vs lib/foreman_tasks/dynflow/configuration.rb in foreman-tasks-0.9.0
- old
+ new
@@ -1,17 +1,16 @@
module ForemanTasks
class Dynflow::Configuration
-
# the number of threads in the pool handling the execution
attr_accessor :pool_size
# the size of db connection pool
attr_accessor :db_pool_size
# set true if the executor runs externally (by default true in procution, othewise false)
attr_accessor :remote
- alias_method :remote?, :remote
+ alias remote? remote
# what transaction adapater should be used, by default, it uses the ActiveRecord
# based adapter, expecting ActiveRecord is used as ORM in the application
attr_accessor :transaction_adapter
@@ -32,11 +31,11 @@
self.db_pool_size = pool_size + 5
self.remote = Rails.env.production?
self.transaction_adapter = ::Dynflow::TransactionAdapters::ActiveRecord.new
self.eager_load_paths = []
self.lazy_initialization = !Rails.env.production?
- self.rake_tasks_with_executor = %w[db:migrate db:seed]
+ self.rake_tasks_with_executor = %w(db:migrate db:seed)
@on_init = []
end
# for logging action related info (such as exceptions raised in side
@@ -64,12 +63,12 @@
# No matter what config.remote says, when the process is marked as executor,
# it can't be remote
def remote?
!ForemanTasks.dynflow.executor? &&
- !rake_task_with_executor? &&
- @remote
+ !rake_task_with_executor? &&
+ @remote
end
def rake_task_with_executor?
return false unless defined?(Rake)
@@ -77,11 +76,11 @@
rake_tasks_with_executor.include?(rake_task)
end
end
def increase_db_pool_size?
- ForemanTasks.dynflow.required? && !remote? && !Rails.env.test?
+ ForemanTasks.dynflow.required? && !remote? && !Rails.env.test?
end
# To avoid pottential timeouts on db connection pool, make sure
# we have the pool bigger than the thread pool
def increase_db_pool_size
@@ -124,18 +123,18 @@
# We need to create separate database for sqlite
# to avoid lock conflicts on the database
db_config['database'] = "#{File.dirname(database)}/dynflow-#{File.basename(database)}"
end
end
- return db_config
+ db_config
end
def initialize_executor(world)
- if self.remote?
+ if remote?
false
else
- ::Dynflow::Executors::Parallel.new(world, self.pool_size)
+ ::Dynflow::Executors::Parallel.new(world, pool_size)
end
end
def initialize_connector(world)
::Dynflow::Connectors::Database.new(world)
@@ -143,8 +142,7 @@
# Sequel adapter based on Rails app database.yml configuration
def initialize_persistence
ForemanTasks::Dynflow::Persistence.new(default_sequel_adapter_options)
end
-
end
end