Class: ForemanRhCloud::InsightsStatusCleaner
- Inherits:
 - 
      Object
      
        
- Object
 - ForemanRhCloud::InsightsStatusCleaner
 
 
- Defined in:
 - app/services/foreman_rh_cloud/insights_status_cleaner.rb
 
Instance Method Summary collapse
Instance Method Details
#clean(host_search) ⇒ Object
      3 4 5 6 7 8 9 10 11 12 13 14 15  | 
    
      # File 'app/services/foreman_rh_cloud/insights_status_cleaner.rb', line 3 def clean(host_search) host_ids = Host.search_for(host_search).pluck(:id) # delete all insights status records for the hosts deleted_count = InsightsClientReportStatus.where(host_id: host_ids).delete_all # refresh global status Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts| hosts.each { |host| host.refresh_global_status! } end deleted_count end  |