class InventorySync::Async::InventoryHostsSync
Public Instance Methods
create_facets() { || ... }
click to toggle source
# File lib/inventory_sync/async/inventory_hosts_sync.rb, line 13 def create_facets # get the results from the event results = yield add_missing_insights_facets(results.host_uuids) results end
setup_facet_transaction() { || ... }
click to toggle source
# File lib/inventory_sync/async/inventory_hosts_sync.rb, line 7 def setup_facet_transaction InsightsFacet.transaction do yield end end
Private Instance Methods
add_missing_insights_facets(uuids_hash)
click to toggle source
# File lib/inventory_sync/async/inventory_hosts_sync.rb, line 22 def add_missing_insights_facets(uuids_hash) existing_facets = InsightsFacet.where(host_id: uuids_hash.keys).pluck(:host_id) missing_facets = uuids_hash.except(*existing_facets).map do |host_id, uuid| { host_id: host_id, uuid: uuid, } end InsightsFacet.create(missing_facets) end