diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-13 21:34:22 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-13 21:34:22 +0000 |
commit | 22e70f069cec86f94e17774c9c2b84b1bb9cda6c (patch) | |
tree | 23848807bd8e719ca6e0029d06eb6c542162d64d /lib/puppet/rails/host.rb | |
parent | 637cc71296f96fd1d5f2ca83aa7e20c73757f8dd (diff) | |
download | puppet-22e70f069cec86f94e17774c9c2b84b1bb9cda6c.tar.gz puppet-22e70f069cec86f94e17774c9c2b84b1bb9cda6c.tar.xz puppet-22e70f069cec86f94e17774c9c2b84b1bb9cda6c.zip |
Made a *huge* performance difference in storing hosts -- down from about 25 seconds per host to about 5 seconds on my machine. I will almost definitely still use forking or something to make this not affect the clients
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1191 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails/host.rb')
-rw-r--r-- | lib/puppet/rails/host.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 65be5294b..ace906117 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -1,6 +1,6 @@ require 'puppet/rails/rails_object' -RailsObject = Puppet::Rails::RailsObject +#RailsObject = Puppet::Rails::RailsObject class Puppet::Rails::Host < ActiveRecord::Base Host = self serialize :facts, Hash @@ -45,11 +45,13 @@ class Puppet::Rails::Host < ActiveRecord::Base host[param] = hostargs[param] end end + host.addobjects(objects) else - host = Host.new(hostargs) + host = Host.new(hostargs) do |hostobj| + hostobj.addobjects(objects) + end end - host.addobjects(objects) host.save @@ -69,15 +71,12 @@ class Puppet::Rails::Host < ActiveRecord::Base end end - robj = RailsObject.new(args) + robj = rails_objects.build(args) + robj.addparams(params) if tobj.collectable robj.toggle(:collectable) end - - self.rails_objects << robj - - robj.addparams(params) end end end |