Sha256: e2672fa1df446e12cccfd6ed3d4995e01373d37e6d121dfeb52a25e47d4ab983

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

module Ecoportal
  module API
    module Common
      class Client
        module TimeOut
          MIN_THROUGHPUT = 0.2 # people per second
          MIN_SIZE       = 10

          private

          def min_throughput
            self.class::MIN_THROUGHPUT
          end

          def min_size
            self.class::MIN_SIZE
          end

          def timeout_for(count)
            count = 1        unless count&.positive?
            count = min_size if count < min_size
            (count.ceil / min_throughput).ceil
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecoportal-api-0.10.3 lib/ecoportal/api/common/client/time_out.rb