Skip to content

Commit

Permalink
Do not build vm_and_templates through association
Browse files Browse the repository at this point in the history
Do not build vm_and_templates through association, rails are
caching all the objects there, making it huge in memory.
  • Loading branch information
Ladas committed Apr 11, 2017
1 parent 776aee8 commit df636f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/ems_refresh/save_inventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def save_vms_inventory(ems, hashes, target = nil)
h[:location] = "unknown" if h[:location].blank?

# build a type-specific vm or template
found = ems.vms_and_templates.build(h)
found = ems.vms_and_templates.klass.new(h)
else
vms_by_uid_ems[h[:uid_ems]].delete(found)
h.delete(:type)
Expand Down

0 comments on commit df636f2

Please sign in to comment.