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.1.4.pre.rc12-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc12 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc11-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc11 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc10-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc10 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc9-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc9 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc8-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc8 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc7-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc7 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc6-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc6 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc5-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc5 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc4-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc4 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc3-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.4.pre.rc3 lib/splitclient-rb/sse/event_source/back_off.rb