Class: Sbmt::Outbox::V2::PollThrottler::PausedBox

Inherits:
Base show all
Defined in:
lib/sbmt/outbox/v2/poll_throttler/paused_box.rb

Instance Method Summary collapse

Methods inherited from Base

#call

Methods inherited from DryInteractor

call

Constructor Details

#initialize(delay: 0.1) ⇒ PausedBox

Returns a new instance of PausedBox.



11
12
13
14
15
# File 'lib/sbmt/outbox/v2/poll_throttler/paused_box.rb', line 11

def initialize(delay: 0.1)
  super()

  @delay = delay
end

Instance Method Details

#wait(worker_num, poll_task, task_result) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/sbmt/outbox/v2/poll_throttler/paused_box.rb', line 17

def wait(worker_num, poll_task, task_result)
  return Success(Sbmt::Outbox::V2::Throttler::NOOP_STATUS) if poll_task.item_class.config.polling_enabled?

  sleep(@delay)

  Success(Sbmt::Outbox::V2::Throttler::SKIP_STATUS)
end