Class: Qpid::Proton::Reactor::Backoff
- Inherits:
-
Object
- Object
- Qpid::Proton::Reactor::Backoff
- Defined in:
- lib/reactor/backoff.rb
Instance Method Summary collapse
-
#initialize ⇒ Backoff
constructor
A new instance of Backoff.
- #next ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Backoff
Returns a new instance of Backoff.
24 25 26 |
# File 'lib/reactor/backoff.rb', line 24 def initialize @delay = 0 end |
Instance Method Details
#next ⇒ Object
32 33 34 35 36 37 |
# File 'lib/reactor/backoff.rb', line 32 def next current = @delay current = 0.1 if current.zero? @delay = [10, 2 * current].min return current end |
#reset ⇒ Object
28 29 30 |
# File 'lib/reactor/backoff.rb', line 28 def reset @delay = 0 end |