Sha256: e097e09815a3bd7d4dd3daed43788d635891b39a051191d860d0ad85ba64956e

Contents?: true

Size: 432 Bytes

Versions: 6

Compression:

Stored size: 432 Bytes

Contents

module S3Website
  class Parallelism
    def self.each_in_parallel_or_sequentially(items, &operation)
      if ENV['disable_parallel_processing']
        items.each do |item|
          operation.call item
        end
      else
        threads = items.map do |item|
          Thread.new(item) { |item|
            operation.call item
          }
        end
        threads.each { |thread| thread.join }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
s3_website-1.0.0 lib/s3_website/parallelism.rb
s3_website-0.4.0 lib/s3_website/parallelism.rb
s3_website-0.3.0 lib/s3_website/parallelism.rb
s3_website-0.2.1 lib/s3_website/parallelism.rb
s3_website-0.2.0 lib/s3_website/parallelism.rb
s3_website-0.1.0 lib/s3_website/parallelism.rb