Sha256: 66f43d43fb1756e8f2195b15c6fc870d10971b8ef1c484e3f8c7f4682cd9457d

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'grpc_kit/rpcs'
require 'grpc_kit/calls/client_request_response'

module GrpcKit
  module Rpcs::Client
    class RequestResponse < GrpcKit::Rpcs::ClientRpc
      # @param stream [GrpcKit::Stream::ClientStream]
      # @param request [Object] request message
      # @param metadata [Hash<String, String>]
      # @param timeout [GrpcKit::GrpcTime]
      # @return [Object] response message
      def invoke(stream, request, metadata: {}, timeout: nil)
        call = GrpcKit::Calls::Client::RequestResponse.new(
          metadata: metadata,
          config: @config,
          timeout: timeout,
          stream: stream,
        )

        Timeout.timeout(timeout&.to_f, GrpcKit::Errors::DeadlineExceeded) do
          if @config.interceptor
            @config.interceptor.intercept(request, call, call.metadata) do
              call.send_msg(request)
              call.recv
            end
          else
            call.send_msg(request)
            call.recv
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
grpc_kit-0.5.1 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.5.0 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.4.0 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.9 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.8 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.7 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.6 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.5 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.4 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.3 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.2 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.1 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.3.0 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.2.1 lib/grpc_kit/rpcs/client_request_response.rb
grpc_kit-0.2.0 lib/grpc_kit/rpcs/client_request_response.rb