Sha256: ecf2b30ac90a1fe65b32fb0bea64ab4636bf3289900a5b5e45d59321001c5acf

Contents?: true

Size: 570 Bytes

Versions: 28

Compression:

Stored size: 570 Bytes

Contents

module Pacer
  module Routes
    module RouteOperations
      def parallel(opts = {}, &block)
        threads = opts.fetch(:threads, 2)
        branched = (0..threads).reduce(channel_cap buffer: opts.fetch(:in_buffer, threads)) do |r, n|
          r.branch do |x|
            b = block.call x.channel_reader
            b.channel_cap
          end
        end
        branched.merge_exhaustive.gather.channel_fan_in(buffer: opts.fetch(:out_buffer, threads),
                                                        based_on: block.call(self))
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
pacer-2.0.24-java lib/pacer/transform/parallel.rb
pacer-2.0.22-java lib/pacer/transform/parallel.rb
pacer-2.0.20-java lib/pacer/transform/parallel.rb
pacer-2.0.19-java lib/pacer/transform/parallel.rb
pacer-2.0.18-java lib/pacer/transform/parallel.rb
pacer-2.0.17-java lib/pacer/transform/parallel.rb
pacer-2.0.16-java lib/pacer/transform/parallel.rb
pacer-2.0.15-java lib/pacer/transform/parallel.rb
pacer-2.0.14-java lib/pacer/transform/parallel.rb
pacer-2.0.13-java lib/pacer/transform/parallel.rb
pacer-2.0.12-java lib/pacer/transform/parallel.rb
pacer-2.0.10-java lib/pacer/transform/parallel.rb
pacer-2.0.10.pre-java lib/pacer/transform/parallel.rb
pacer-2.0.8-java lib/pacer/transform/parallel.rb
pacer-2.0.6-java lib/pacer/transform/parallel.rb
pacer-2.0.4.pre-java lib/pacer/transform/parallel.rb
pacer-2.0.0.pre-java lib/pacer/transform/parallel.rb
pacer-1.6.0-java lib/pacer/transform/parallel.rb
pacer-1.5.4-java lib/pacer/transform/parallel.rb
pacer-1.5.3-java lib/pacer/transform/parallel.rb