Class: Sbmt::Outbox::V2::PollThrottler::FixedDelay
- Inherits:
-
Base
- Object
- DryInteractor
- Base
- Sbmt::Outbox::V2::PollThrottler::FixedDelay
- Defined in:
- lib/sbmt/outbox/v2/poll_throttler/fixed_delay.rb
Instance Method Summary collapse
-
#initialize(delay:) ⇒ FixedDelay
constructor
A new instance of FixedDelay.
- #wait(worker_num, poll_task, task_result) ⇒ Object
Methods inherited from Base
Methods inherited from DryInteractor
Constructor Details
#initialize(delay:) ⇒ FixedDelay
Returns a new instance of FixedDelay.
11 12 13 14 15 |
# File 'lib/sbmt/outbox/v2/poll_throttler/fixed_delay.rb', line 11 def initialize(delay:) 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/fixed_delay.rb', line 17 def wait(worker_num, poll_task, task_result) return Success(Sbmt::Outbox::V2::Throttler::NOOP_STATUS) unless task_result == Sbmt::Outbox::V2::ThreadPool::PROCESSED sleep(@delay) Success(Sbmt::Outbox::V2::Throttler::THROTTLE_STATUS) end |