Sha256: 1db0ab715edb39f1c2bf77d5d7707e095fdcc3584d1d68dc10351dee8b7da004

Contents?: true

Size: 583 Bytes

Versions: 24

Compression:

Stored size: 583 Bytes

Contents

module Lhm
  module Throttler
    class Time
      include Command

      DEFAULT_TIMEOUT = 0.1
      DEFAULT_STRIDE = 2_000

      attr_accessor :timeout_seconds
      attr_accessor :stride

      def initialize(options = {})
        @timeout_seconds = options[:delay] || DEFAULT_TIMEOUT
        @stride = options[:stride] || DEFAULT_STRIDE
      end

      def execute
        sleep timeout_seconds
      end
    end

    class LegacyTime < Time
      def initialize(timeout, stride)
        @timeout_seconds = timeout / 1000.0
        @stride = stride
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
lhm-shopify-4.3.0 lib/lhm/throttler/time.rb
lhm-shopify-4.2.3 lib/lhm/throttler/time.rb
lhm-shopify-4.2.2 lib/lhm/throttler/time.rb
lhm-shopify-4.2.1 lib/lhm/throttler/time.rb
lhm-shopify-4.2.0 lib/lhm/throttler/time.rb
lhm-shopify-4.1.1 lib/lhm/throttler/time.rb
lhm-shopify-4.1.0 lib/lhm/throttler/time.rb
lhm-shopify-4.0.0 lib/lhm/throttler/time.rb
lhm-teak-3.6.4 lib/lhm/throttler/time.rb
lhm-teak-3.6.3 lib/lhm/throttler/time.rb
lhm-teak-3.6.2 lib/lhm/throttler/time.rb
lhm-teak-3.6.1 lib/lhm/throttler/time.rb
lhm-teak-3.6.0 lib/lhm/throttler/time.rb
lhm-shopify-3.5.5 lib/lhm/throttler/time.rb
lhm-shopify-3.5.4 lib/lhm/throttler/time.rb
lhm-shopify-3.5.3 lib/lhm/throttler/time.rb
lhm-shopify-3.5.2 lib/lhm/throttler/time.rb
lhm-shopify-3.5.0 lib/lhm/throttler/time.rb
lhm-shopify-3.5.1 lib/lhm/throttler/time.rb
lhm-shopify-3.4.2 lib/lhm/throttler/time.rb