Class: PackAPI::ValuesInBackgroundBatches
- Inherits:
-
ValuesInBatches
- Object
- ValuesInBatches
- PackAPI::ValuesInBackgroundBatches
- Includes:
- Enumerable
- Defined in:
- lib/pack_api/values_in_background_batches.rb
Instance Attribute Summary collapse
-
#background_worker ⇒ Object
readonly
Returns the value of attribute background_worker.
-
#low_watermark ⇒ Object
readonly
Returns the value of attribute low_watermark.
Attributes inherited from ValuesInBatches
#batch_size, #kwargs, #method, #optional_attributes
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(method:, batch_size:, optional_attributes: nil, **kwargs, &block) ⇒ ValuesInBackgroundBatches
constructor
A new instance of ValuesInBackgroundBatches.
Methods inherited from ValuesInBatches
Constructor Details
#initialize(method:, batch_size:, optional_attributes: nil, **kwargs, &block) ⇒ ValuesInBackgroundBatches
Returns a new instance of ValuesInBackgroundBatches.
9 10 11 12 |
# File 'lib/pack_api/values_in_background_batches.rb', line 9 def initialize(method:, batch_size:, optional_attributes: nil, **kwargs, &block) super @low_watermark = 1 end |
Instance Attribute Details
#background_worker ⇒ Object (readonly)
Returns the value of attribute background_worker.
7 8 9 |
# File 'lib/pack_api/values_in_background_batches.rb', line 7 def background_worker @background_worker end |
#low_watermark ⇒ Object (readonly)
Returns the value of attribute low_watermark.
7 8 9 |
# File 'lib/pack_api/values_in_background_batches.rb', line 7 def low_watermark @low_watermark end |
Instance Method Details
#each ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/pack_api/values_in_background_batches.rb', line 14 def each @background_worker = Rails.env.test? ? Concurrent::ImmediateExecutor.new : Concurrent::SingleThreadExecutor.new super background_worker.shutdown @background_worker = nil end |