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-3.4.1 lib/lhm/throttler/time.rb
lhm-shopify-3.4.0 lib/lhm/throttler/time.rb
lhm-shopify-3.3.6 lib/lhm/throttler/time.rb
lhm-shopify-3.3.5 lib/lhm/throttler/time.rb