app/models/manageiq/providers/kubernetes/inventory/collector/container_manager/watch_notice.rb
# The notices returned by the Kubernetes API contain always the complete
# representation of the object, so it isn't necessary to process all of them,
# only the last one for each object.
The notices returned by the Kubernetes API contain always the complete
representation of the object, so it isn't necessary to process all of them,
only the last one for each object.
The notices returned by the Kubernetes API contain always the complete representation of the object so it isn ' t necessary to process all of them only the last one for each object .
def filter_notices(all_notices)
    notices_by_kind = all_notices.group_by { |notice| notice.object&.kind }.except(nil)
    notices_by_kind.values.each_with_object([]) do |notices, result|
      notices.reverse!.uniq! { |n| n.object&.metadata&.uid }
      result.concat(notices)
    end
  end
def filter_notices ( all_notices ) notices_by_kind = all_notices . group_by { | notice | notice . object &. kind } . except ( nil ) notices_by_kind . values . each_with_object ( [ ] ) do | notices , result | notices . reverse! . uniq! { | n | n . object &. metadata &. uid } result . concat ( notices ) end end
The notices returned by the Kubernetes API contain always the complete
representation of the object, so it isn't necessary to process all of them,
only the last one for each object.
The notices returned by the Kubernetes API contain always the complete representation of the object so it isn ' t necessary to process all of them only the last one for each object .
all_notices