Method: Sbmt::Outbox::V2::Poller#initialize

Defined in:
lib/sbmt/outbox/v2/poller.rb

#initialize(boxes, partitions_count: nil, threads_count: nil, lock_timeout: nil, regular_items_batch_size: nil, retryable_items_batch_size: nil, throttler_tactic: nil, redis: nil) ⇒ Poller

Returns a new instance of Poller.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sbmt/outbox/v2/poller.rb', line 17

def initialize(
  boxes,
  partitions_count: nil,
  threads_count: nil,
  lock_timeout: nil,
  regular_items_batch_size: nil,
  retryable_items_batch_size: nil,
  throttler_tactic: nil,
  redis: nil
)
  @partitions_count = partitions_count || poller_config.concurrency
  @lock_timeout = lock_timeout || poller_config.general_timeout

  @regular_items_batch_size = regular_items_batch_size || poller_config.regular_items_batch_size
  @retryable_items_batch_size = retryable_items_batch_size || poller_config.retryable_items_batch_size
  @max_buffer_size = @regular_items_batch_size + @retryable_items_batch_size
  @max_batch_size = @regular_items_batch_size

  super(boxes: boxes, threads_count: threads_count || poller_config.threads_count, name: "poller", redis: redis)

  @throttler = PollThrottler.build(throttler_tactic || poller_config.tactic || "default", self.redis, poller_config)
end