Skip to content

Commit

Permalink
Merge pull request #15067 from isimluk/schedule-ssa-job-dispatch-on-d…
Browse files Browse the repository at this point in the history
…emand

Performance: Do not schedule smartstate dispatch unless it is needed
  • Loading branch information
gtanzillo authored May 16, 2017
2 parents c559da0 + 1b10ea7 commit fdbf5c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/models/job_proxy_dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def assign_proxy_to_job(proxy, job)
end
end

def self.waiting?
Job.where(:state => 'waiting_to_start').exists?
end

def pending_jobs(target_class = VmOrTemplate)
class_name = target_class.base_class.name
@zone = MiqServer.my_zone
Expand Down
4 changes: 3 additions & 1 deletion app/models/miq_schedule_worker/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def job_check_for_evm_snapshots(job_not_found_delay)
end

def job_proxy_dispatcher_dispatch
queue_work_on_each_zone(:class_name => "JobProxyDispatcher", :method_name => "dispatch", :task_id => "job_dispatcher", :priority => MiqQueue::HIGH_PRIORITY, :role => "smartstate", :state => "ready")
if JobProxyDispatcher.waiting?
queue_work_on_each_zone(:class_name => "JobProxyDispatcher", :method_name => "dispatch", :task_id => "job_dispatcher", :priority => MiqQueue::HIGH_PRIORITY, :role => "smartstate", :state => "ready")
end
end

def ems_refresh_timer(klass)
Expand Down

0 comments on commit fdbf5c1

Please sign in to comment.