Sha256: 47ed2ced1711151f4f540ef557d3180a4a037a51fd57254ea4c04771e7b9d942

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

module Momento
  # Encapsulates gRPC configuration tunables
  class GrpcConfiguration
    # Number of milliseconds the client is willing to wait for an RPC to
    # complete before it is terminated with a DeadlineExceeded error
    attr_reader :deadline

    def self.with_deadline(deadline)
      return GrpcConfiguration.new(deadline)
    end

    def initialize(deadline)
      unless deadline.is_a? Integer
        raise Momento::Error::InvalidArgumentError,
          'Client timeout must be an integer'
      end
      if (deadline.is_a? Integer) && (deadline < 1)
        raise Momento::Error::InvalidArgumentError,
          'Client timeout must be positive'
      end

      @deadline = deadline
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
momento-0.4.9 lib/momento/config/transport/grpc_configuration.rb