Module: Philiprehberger::Batch
- Defined in:
- lib/philiprehberger/batch.rb,
lib/philiprehberger/batch/chunk.rb,
lib/philiprehberger/batch/result.rb,
lib/philiprehberger/batch/version.rb,
lib/philiprehberger/batch/processor.rb
Defined Under Namespace
Classes: Chunk, Error, Processor, Result, TimeoutError
Constant Summary collapse
- VERSION =
'0.7.0'
Class Method Summary collapse
-
.process(collection, size: 100, concurrency: 1, retries: 0, timeout_per_chunk: nil, on_progress: nil) {|chunk| ... } ⇒ Result
Process a collection in batches with chunking, progress, and error collection.
Class Method Details
.process(collection, size: 100, concurrency: 1, retries: 0, timeout_per_chunk: nil, on_progress: nil) {|chunk| ... } ⇒ Result
Process a collection in batches with chunking, progress, and error collection.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/philiprehberger/batch.rb', line 29 def self.process(collection, size: 100, concurrency: 1, retries: 0, timeout_per_chunk: nil, on_progress: nil, &block) processor = Processor.new( size: size, concurrency: concurrency, retries: retries, timeout_per_chunk: timeout_per_chunk ) processor.call(collection, on_progress: on_progress, &block) end |