Sha256: cd9e326cc545266e2cba7b583e3613d6e2de509de312725f22277b953664d950

Contents?: true

Size: 483 Bytes

Versions: 110

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: false

module SplitIoClient
  module SSE
    module EventSource
      class BackOff
        def initialize(back_off_base, attempt = 0)
          @attempt = attempt
          @back_off_base = back_off_base
        end

        def interval
          interval = (@back_off_base * (2**@attempt)) if @attempt.positive?
          @attempt += 1

          interval || 0
        end

        def reset
          @attempt = 0
        end
      end
    end
  end
end

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
splitclient-rb-7.3.0-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc3-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc3 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc2-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc2 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc1-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.3.0.pre.rc1 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3.pre.rc2-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3.pre.rc2 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3.pre.rc1-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.3.pre.rc1 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.2-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.2 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.2.pre.rc1-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.2.pre.rc1 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.1-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.2.1 lib/splitclient-rb/sse/event_source/back_off.rb