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