Skip to content

Commit

Permalink
Throttler Replace class constant with global setting
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiendupont committed Mar 10, 2019
1 parent 59b8dc4 commit e62d533
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/infra_conversion_throttler.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
class InfraConversionThrottler
DEFAULT_EMS_MAX_RUNNERS = 10

def self.start_conversions
pending_conversion_jobs.each do |ems, jobs|
running = ems.conversion_hosts.inject(0) { |sum, ch| sum + ch.active_tasks.size }
slots = (ems.miq_custom_get('Max Transformation Runners') || DEFAULT_EMS_MAX_RUNNERS).to_i - running
slots = (ems.miq_custom_get('Max Transformation Runners') || Settings.transformation.limits.max_concurrent_tasks_per_ems).to_i - running
jobs.each do |job|
eligible_hosts = ems.conversion_hosts.select(&:eligible?).sort_by { |ch| ch.active_tasks.size }
break if slots <= 0 || eligible_hosts.empty?
Expand Down

0 comments on commit e62d533

Please sign in to comment.