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.0.pre.rc19-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc19 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc18-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc18 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc17-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc17 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc16-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc16 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc15-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc15 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc14-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc14 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc13-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc13 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc12-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc12 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc11-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc11 lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc10-java lib/splitclient-rb/sse/event_source/back_off.rb
splitclient-rb-7.1.0.pre.rc10 lib/splitclient-rb/sse/event_source/back_off.rb