Sha256: a8345443e0708d79aedc3fd84214fa55b8a16ac33e243098f498eb48e8921a68
Contents?: true
Size: 618 Bytes
Versions: 42
Compression:
Stored size: 618 Bytes
Contents
module S3Website class Parallelism def self.each_in_parallel_or_sequentially(items, config, &operation) if ENV['disable_parallel_processing'] items.each do |item| operation.call item end else slice_size = config['concurrency_level'] || DEFAULT_CONCURRENCY_LEVEL items.each_slice(slice_size) { |items| threads = items.map do |item| Thread.new(item) { |item| operation.call item } end threads.each(&:join) } end end private DEFAULT_CONCURRENCY_LEVEL = 3 end end
Version data entries
42 entries across 42 versions & 2 rubygems