Project

General

Profile

« Previous | Next » 

Revision 6de94a2c

Added by Partha Aji almost 6 years ago

Fixes #23604 - Speed up manifest import perf

This commit intends to speed up the performance of the manifest import
by cutting down unnecessary operations during the Pool indexing stage.

Before
timer { Katello::Pool.find(446).import_data }
=> 12.708098227

After

timer { Katello::Pool.find(446).import_data }

=> 0.029546651

View differences:

app/models/katello/glue/candlepin/pool.rb
end
# rubocop:disable MethodLength
def import_data(index_hosts = false)
def import_data(index_hosts_and_activation_keys = false)
pool_attributes = {}.with_indifferent_access
pool_json = self.backend_data
......
exceptions = pool_attributes.keys.map(&:to_sym) - self.attribute_names.map(&:to_sym)
self.update_attributes(pool_attributes.except!(*exceptions))
self.save!
self.create_activation_key_associations
self.create_activation_key_associations if index_hosts_and_activation_keys
self.create_product_associations
self.import_hosts if index_hosts
self.import_hosts if index_hosts_and_activation_keys
end
def create_product_associations
......
def import_managed_associations
import_hosts
create_activation_key_associations
end
def hosts

Also available in: Unified diff