foreman-tasks 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -132,6 +132,9 @@ module ForemanTasks
132
132
  end
133
133
  end
134
134
  return true
135
+ ensure
136
+ # to not execute the same execution plan twice in a row
137
+ @execution_plan = nil
135
138
  end
136
139
  end
137
140
  end
@@ -46,6 +46,7 @@ module ForemanTasks
46
46
  # every time the new world is created when there is a register
47
47
  # of executors
48
48
  world.consistency_check
49
+ world.execute_planned_execution_plans
49
50
  end
50
51
  end
51
52
  end
@@ -11,6 +11,9 @@ module ForemanTasks
11
11
  # the number of threads in the pool handling the execution
12
12
  attr_accessor :pool_size
13
13
 
14
+ # the size of db connection pool
15
+ attr_accessor :db_pool_size
16
+
14
17
  # set true if the executor runs externally (by default true in procution, othewise false)
15
18
  attr_accessor :remote
16
19
  alias_method :remote?, :remote
@@ -34,6 +37,7 @@ module ForemanTasks
34
37
  self.action_logger = Rails.logger
35
38
  self.dynflow_logger = Rails.logger
36
39
  self.pool_size = 5
40
+ self.db_pool_size = pool_size + 5
37
41
  self.remote = Rails.env.production?
38
42
  self.remote_socket_path = File.join(Rails.root, "tmp", "sockets", "dynflow_socket")
39
43
  self.transaction_adapter = ::Dynflow::TransactionAdapters::ActiveRecord.new
@@ -84,6 +88,7 @@ module ForemanTasks
84
88
  def default_sequel_adapter_options
85
89
  db_config = ActiveRecord::Base.configurations[Rails.env].dup
86
90
  db_config['adapter'] = 'postgres' if db_config['adapter'] == 'postgresql'
91
+ db_config['max_connections'] = db_config['pool'] if db_config['pool']
87
92
 
88
93
  if db_config['adapter'] == 'sqlite3'
89
94
  db_config['adapter'] = 'sqlite'
@@ -107,7 +112,20 @@ module ForemanTasks
107
112
 
108
113
  # Sequel adapter based on Rails app database.yml configuration
109
114
  def initialize_persistence
115
+ unless remote?
116
+ increase_db_pool_size
117
+ end
110
118
  ForemanTasks::Dynflow::Persistence.new(default_sequel_adapter_options)
111
119
  end
120
+
121
+ # To avoid pottential timeouts on db connection pool, make sure
122
+ # we have the pool bigger than the thread pool
123
+ def increase_db_pool_size
124
+ ActiveRecord::Base.connection_pool.disconnect!
125
+
126
+ config = ActiveRecord::Base.configurations[Rails.env]
127
+ config['pool'] = db_pool_size if config['pool'].to_i < db_pool_size
128
+ ActiveRecord::Base.establish_connection(config)
129
+ end
112
130
  end
113
131
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanTasks
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-10 00:00:00.000000000 Z
12
+ date: 2014-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails