Sha256: f8573562672758fac4dd3e617e5589a29fc1c1efc328d229bc879344dbb8b3cc
Contents?: true
Size: 782 Bytes
Versions: 6
Compression:
Stored size: 782 Bytes
Contents
module InstDataShipper module Destinations module Concerns module Chunking extend ActiveSupport::Concern DEFAULT_CHUNK_SIZE = 100_000 def chunk_data(generator, chunk_size: nil, **kwargs) chunk_size ||= config&.dig(:params, :chunk_size) || DEFAULT_CHUNK_SIZE slice = 1 btchr = CanvasSync::BatchProcessor.new(of: chunk_size) do |batch| yield batch, slice slice += 1 end super(generator, **kwargs) do |row| btchr << row end btchr.flush end def group_key super.tap do |k| k[:chunk_size] = config&.dig(:params, :chunk_size) || DEFAULT_CHUNK_SIZE end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems