Skip to content

Commit

Permalink
Merge pull request #18539 from fdupont-redhat/v2v_use_settings_for_ma…
Browse files Browse the repository at this point in the history
…x_concurrent_tasks_per_ems

[V2V] Throttler - Replace class constant with global setting
  • Loading branch information
agrare committed Mar 11, 2019
2 parents 59b8dc4 + e62d533 commit 5b6e5c5
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 5b6e5c5

Please sign in to comment.