class InsightsCloud::Async::InsightsClientStatusAging

Public Instance Methods

logger() click to toggle source
# File lib/insights_cloud/async/insights_client_status_aging.rb, line 18
def logger
  action_logger
end
rescue_strategy_for_self() click to toggle source
# File lib/insights_cloud/async/insights_client_status_aging.rb, line 22
def rescue_strategy_for_self
  Dynflow::Action::Rescue::Fail
end
run() click to toggle source
# File lib/insights_cloud/async/insights_client_status_aging.rb, line 6
def run
  host_ids = InsightsClientReportStatus.stale.reporting.pluck(:host_id)

  # update all stale records
  InsightsClientReportStatus.where(host_id: host_ids).update_all(status: InsightsClientReportStatus::NO_REPORT)

  # refresh global status
  Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts|
    hosts.each { |host| host.refresh_global_status! }
  end
end