Skip to content

Commit

Permalink
Reload the miq_workers association if a worker was deleted
Browse files Browse the repository at this point in the history
This removes the collection editing entirely while also removing
the need to track individual worker ids.
  • Loading branch information
carbonin committed Dec 10, 2019
1 parent c156dcc commit 1562a76
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/models/miq_server/worker_management/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ def sync_workers
end

def clean_worker_records
worker_deleted = false
miq_workers.each do |w|
next unless w.is_stopped?
_log.info("SQL Record for #{w.format_full_log_msg}, Status: [#{w.status}] is being deleted")
worker_delete(w.pid)
w.destroy
miq_workers.delete(w)
worker_deleted = true
end

miq_workers.reload if worker_deleted
end

def check_pending_stop
Expand All @@ -85,15 +88,18 @@ def check_pending_stop
end

def check_not_responding
return [] if MiqEnvironment::Command.is_podified?
return if MiqEnvironment::Command.is_podified?

worker_deleted = false
miq_workers.each do |w|
next unless monitor_reason_not_responding?(w)
next unless worker_get_monitor_status(w.pid) == :waiting_for_stop
worker_not_responding(w)
worker_delete(w.pid)
miq_workers.delete(w)
worker_deleted = true
end

miq_workers.reload if worker_deleted
end

def monitor_reason_not_responding?(w)
Expand Down

0 comments on commit 1562a76

Please sign in to comment.