[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:31:04 UTC 2010


The following commit has been merged in the upstream branch:
commit ec7ea27e356dc159b37cc2a09b6f14841e796ab2
Author: Luke Kanies <luke at reductivelabs.com>
Date:   Mon Mar 22 16:39:21 2010 -0700

    Refactoring event queueing for performance
    
    This does some normalization so we're not doing
    duplicate queries for large event collections.
    
    Signed-off-by: Luke Kanies <luke at reductivelabs.com>

diff --git a/lib/puppet/transaction/event_manager.rb b/lib/puppet/transaction/event_manager.rb
index f74927b..24e5778 100644
--- a/lib/puppet/transaction/event_manager.rb
+++ b/lib/puppet/transaction/event_manager.rb
@@ -33,7 +33,17 @@ class Puppet::Transaction::EventManager
     def queue_events(resource, events)
         @events += events
 
-        events.each do |event|
+        # Do some basic normalization so we're not doing so many
+        # graph queries for large sets of events.
+        events.inject({}) do |collection, event|
+            collection[event.name] ||= []
+            collection[event.name] << event
+            collection
+        end.collect do |name, list|
+            # It doesn't matter which event we use - they all have the same source
+            # and name here.
+            event = list[0]
+
             # Collect the targets of any subscriptions to those events.  We pass
             # the parent resource in so it will override the source in the events,
             # since eval_generated children can't have direct relationships.
@@ -41,7 +51,9 @@ class Puppet::Transaction::EventManager
                 next unless method = edge.callback
                 next unless edge.target.respond_to?(method)
 
-                queue_event_for_resource(resource, edge.target, method, event)
+                list.each do |e|
+                    queue_event_for_resource(resource, edge.target, method, e)
+                end
             end
 
             if resource.self_refresh? and ! resource.deleting?

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list