lib/bolt/executor.rb in bolt-1.5.0 vs lib/bolt/executor.rb in bolt-1.6.0
- old
+ new
@@ -30,13 +30,19 @@
@logger = Logging.logger[self]
@plan_logging = false
@load_config = load_config
@transports = Bolt::TRANSPORTS.each_with_object({}) do |(key, val), coll|
- coll[key.to_s] = Concurrent::Delay.new do
- val.new
- end
+ coll[key.to_s] = if key == :remote
+ Concurrent::Delay.new do
+ val.new(self)
+ end
+ else
+ Concurrent::Delay.new do
+ val.new
+ end
+ end
end
@reported_transports = Set.new
@noop = noop
@run_as = nil
@@ -62,10 +68,10 @@
# This is the main driver of execution on a list of targets. It first
# groups targets by transport, then divides each group into batches as
# defined by the transport. Yields each batch, along with the corresponding
# transport, to the block in turn and returns an array of result promises.
def queue_execute(targets)
- targets.group_by(&:protocol).flat_map do |protocol, protocol_targets|
+ targets.group_by(&:transport).flat_map do |protocol, protocol_targets|
transport = transport(protocol)
report_transport(transport, protocol_targets.count)
transport.batches(protocol_targets).flat_map do |batch|
batch_promises = Array(batch).each_with_object({}) do |target, h|
h[target] = Concurrent::Promise.new(executor: :immediate)