Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/lib/actions/katello/applicability/hosts/bulk_generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ def queue
::Katello::HOST_TASKS_QUEUE
end

def resource_locks
:link
end

def hostname(host_id)
content_facet = ::Katello::Host::ContentFacet.find_by_host_id(host_id)
content_facet&.host&.name
Expand Down
15 changes: 3 additions & 12 deletions app/models/katello/events/generate_host_applicability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,15 @@ module Events
class GenerateHostApplicability
EVENT_TYPE = 'generate_host_applicability'.freeze

def self.retry_seconds
180
end

def initialize(object_id)
end

def run
return if ::Katello::ApplicableHostQueue.queue_depth == 0

begin
while ::Katello::ApplicableHostQueue.queue_depth != 0
hosts = ::Katello::ApplicableHostQueue.pop_hosts
ForemanTasks.async_task(::Actions::Katello::Applicability::Hosts::BulkGenerate, host_ids: hosts.map(&:host_id))
end
rescue => e
self.retry = true if e.is_a?(ForemanTasks::Lock::LockConflict)
raise e
while ::Katello::ApplicableHostQueue.queue_depth != 0
hosts = ::Katello::ApplicableHostQueue.pop_hosts
ForemanTasks.async_task(::Actions::Katello::Applicability::Hosts::BulkGenerate, host_ids: hosts.map(&:host_id))
end
end
end
Expand Down