Module: Phobos::Processor
- Extended by:
- ActiveSupport::Concern
- Includes:
- Instrumentation
- Included in:
- Actions::ProcessBatchInline, Actions::ProcessMessage
- Defined in:
- lib/phobos/processor.rb
Constant Summary collapse
- MAX_SLEEP_INTERVAL =
3
Constants included from Instrumentation
Instance Method Summary collapse
Methods included from Instrumentation
#instrument, subscribe, unsubscribe
Instance Method Details
#snooze(interval) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/phobos/processor.rb', line 12 def snooze(interval) remaining_interval = interval @listener.send_heartbeat_if_necessary while remaining_interval.positive? sleep [remaining_interval, MAX_SLEEP_INTERVAL].min remaining_interval -= MAX_SLEEP_INTERVAL @listener.send_heartbeat_if_necessary end end |