Sha256: 4fd6cc484c29c81c8f91111a2c13ba3344f3a61bd167b474996fdcc716001d59

Contents?: true

Size: 302 Bytes

Versions: 5

Compression:

Stored size: 302 Bytes

Contents

module AttemptThis
  # Implementation of binary backoff policy. Internal use only.
  class BinaryBackoffPolicy
    # Initializer.
    def initialize(initial_delay)
      @delay = initial_delay
    end

    # Calls the policy.
    def call
      Kernel.sleep(@delay)
      @delay *= 2
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attempt_this-1.0.3 lib/attempt_this/binary_backoff_policy.rb
attempt_this-1.0.2 lib/attempt_this/binary_backoff_policy.rb
attempt_this-1.0.1 lib/attempt_this/binary_backoff_policy.rb
attempt_this-1.0.0 lib/attempt_this/binary_backoff_policy.rb
attempt_this-0.9.1 lib/attempt_this/binary_backoff_policy.rb