foreman-tasks 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ module ForemanTasks
|
|
16
16
|
def cancel_step
|
17
17
|
task = find_task
|
18
18
|
flash[:notice] = _("Trying to cancel step %s") % params[:step_id]
|
19
|
-
ForemanTasks.dynflow.world.event(task.external_id, params[:step_id].to_i, ::Dynflow::Action::Cancellable::Cancel)
|
19
|
+
ForemanTasks.dynflow.world.event(task.external_id, params[:step_id].to_i, ::Dynflow::Action::Cancellable::Cancel).wait
|
20
20
|
redirect_to foreman_tasks_task_path(task)
|
21
21
|
end
|
22
22
|
|
@@ -74,6 +74,22 @@ module ForemanTasks
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
def increase_db_pool_size?
|
78
|
+
ForemanTasks.dynflow.required? && !remote? && !Rails.env.test?
|
79
|
+
end
|
80
|
+
|
81
|
+
# To avoid pottential timeouts on db connection pool, make sure
|
82
|
+
# we have the pool bigger than the thread pool
|
83
|
+
def increase_db_pool_size
|
84
|
+
if increase_db_pool_size?
|
85
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
86
|
+
|
87
|
+
config = ActiveRecord::Base.configurations[Rails.env]
|
88
|
+
config['pool'] = db_pool_size if config['pool'].to_i < db_pool_size
|
89
|
+
ActiveRecord::Base.establish_connection(config)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
77
93
|
protected
|
78
94
|
|
79
95
|
# generates the options hash consumable by the Dynflow's world
|
@@ -88,7 +104,7 @@ module ForemanTasks
|
|
88
104
|
def default_sequel_adapter_options
|
89
105
|
db_config = ActiveRecord::Base.configurations[Rails.env].dup
|
90
106
|
db_config['adapter'] = 'postgres' if db_config['adapter'] == 'postgresql'
|
91
|
-
db_config['max_connections'] =
|
107
|
+
db_config['max_connections'] = db_pool_size if increase_db_pool_size?
|
92
108
|
|
93
109
|
if db_config['adapter'] == 'sqlite3'
|
94
110
|
db_config['adapter'] = 'sqlite'
|
@@ -112,20 +128,8 @@ module ForemanTasks
|
|
112
128
|
|
113
129
|
# Sequel adapter based on Rails app database.yml configuration
|
114
130
|
def initialize_persistence
|
115
|
-
if !remote && !Rails.env.test?
|
116
|
-
increase_db_pool_size
|
117
|
-
end
|
118
131
|
ForemanTasks::Dynflow::Persistence.new(default_sequel_adapter_options)
|
119
132
|
end
|
120
133
|
|
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
|
130
134
|
end
|
131
135
|
end
|
data/lib/foreman_tasks/engine.rb
CHANGED
@@ -58,6 +58,8 @@ module ForemanTasks
|
|
58
58
|
ForemanTasks.dynflow.eager_load_actions!
|
59
59
|
end
|
60
60
|
|
61
|
+
ForemanTasks.dynflow.config.increase_db_pool_size
|
62
|
+
|
61
63
|
unless ForemanTasks.dynflow.config.lazy_initialization
|
62
64
|
if defined?(PhusionPassenger)
|
63
65
|
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
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.
|
4
|
+
version: 0.6.3
|
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-
|
12
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|