[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:05 UTC 2010
The following commit has been merged in the upstream branch:
commit 5aa26d08892010fc62de6adc278f07c8748d75e0
Author: Luke Kanies <luke at reductivelabs.com>
Date: Mon Mar 22 16:42:03 2010 -0700
Changing method profile for other event queueing
It wasn't clear in the first refactor if this was
necessary, but doing the performance optimization
made it clear it was.
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 24e5778..9c5c166 100644
--- a/lib/puppet/transaction/event_manager.rb
+++ b/lib/puppet/transaction/event_manager.rb
@@ -51,23 +51,21 @@ class Puppet::Transaction::EventManager
next unless method = edge.callback
next unless edge.target.respond_to?(method)
- list.each do |e|
- queue_event_for_resource(resource, edge.target, method, e)
- end
+ queue_events_for_resource(resource, edge.target, method, list)
end
if resource.self_refresh? and ! resource.deleting?
- queue_event_for_resource(resource, resource, :refresh, event)
+ queue_events_for_resource(resource, resource, :refresh, [event])
end
end
end
- def queue_event_for_resource(source, target, callback, event)
+ def queue_events_for_resource(source, target, callback, events)
source.info "Scheduling #{callback} of #{target}"
@event_queues[target] ||= {}
@event_queues[target][callback] ||= []
- @event_queues[target][callback] << event
+ @event_queues[target][callback] += events
end
def queued_events(resource)
diff --git a/spec/unit/transaction/event_manager.rb b/spec/unit/transaction/event_manager.rb
index f808377..6b9fe03 100755
--- a/spec/unit/transaction/event_manager.rb
+++ b/spec/unit/transaction/event_manager.rb
@@ -46,8 +46,8 @@ describe Puppet::Transaction::EventManager do
@graph.expects(:matching_edges).with { |event, resource| event == @event }.returns [edge1, edge2]
- @manager.expects(:queue_event_for_resource).with(@resource, edge1.target, edge1.callback, @event)
- @manager.expects(:queue_event_for_resource).with(@resource, edge2.target, edge2.callback, @event)
+ @manager.expects(:queue_events_for_resource).with(@resource, edge1.target, edge1.callback, [@event])
+ @manager.expects(:queue_events_for_resource).with(@resource, edge2.target, edge2.callback, [@event])
@manager.queue_events(@resource, [@event])
end
@@ -57,7 +57,7 @@ describe Puppet::Transaction::EventManager do
@resource.expects(:self_refresh?).returns true
@resource.expects(:deleting?).returns false
- @manager.expects(:queue_event_for_resource).with(@resource, @resource, :refresh, @event)
+ @manager.expects(:queue_events_for_resource).with(@resource, @resource, :refresh, [@event])
@manager.queue_events(@resource, [@event])
end
@@ -67,7 +67,7 @@ describe Puppet::Transaction::EventManager do
@resource.expects(:self_refresh?).returns false
@resource.stubs(:deleting?).returns false
- @manager.expects(:queue_event_for_resource).never
+ @manager.expects(:queue_events_for_resource).never
@manager.queue_events(@resource, [@event])
end
@@ -77,7 +77,7 @@ describe Puppet::Transaction::EventManager do
@resource.expects(:self_refresh?).returns true
@resource.expects(:deleting?).returns true
- @manager.expects(:queue_event_for_resource).never
+ @manager.expects(:queue_events_for_resource).never
@manager.queue_events(@resource, [@event])
end
@@ -87,7 +87,7 @@ describe Puppet::Transaction::EventManager do
@graph.expects(:matching_edges).returns [edge1]
- @manager.expects(:queue_event_for_resource).never
+ @manager.expects(:queue_events_for_resource).never
@manager.queue_events(@resource, [@event])
end
@@ -97,7 +97,7 @@ describe Puppet::Transaction::EventManager do
@graph.expects(:matching_edges).returns [edge1]
- @manager.expects(:queue_event_for_resource).never
+ @manager.expects(:queue_events_for_resource).never
@manager.queue_events(@resource, [@event])
end
@@ -117,7 +117,7 @@ describe Puppet::Transaction::EventManager do
target = stub("target")
2.times do |i|
- @manager.queue_event_for_resource(stub("source", :info => nil), target, "callback#{i}", ["event#{i}"])
+ @manager.queue_events_for_resource(stub("source", :info => nil), target, "callback#{i}", ["event#{i}"])
end
@manager.queued_events(target) { |callback, events| }
@@ -128,7 +128,7 @@ describe Puppet::Transaction::EventManager do
source = stub 'source'
source.expects(:info)
- @manager.queue_event_for_resource(source, target, "callback", ["event"])
+ @manager.queue_events_for_resource(source, target, "callback", ["event"])
@manager.queued_events(target) { |callback, events| }
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list