New CQ for each client call

pull/6153/head
vjpai 9 years ago
parent c75787ba0f
commit 8079afa46e
  1. 11
      src/ruby/lib/grpc/generic/client_stub.rb

@ -85,7 +85,8 @@ module GRPC
# when present, this is the default timeout used for calls # when present, this is the default timeout used for calls
# #
# @param host [String] the host the stub connects to # @param host [String] the host the stub connects to
# @param q [Core::CompletionQueue] used to wait for events # @param q [Core::CompletionQueue] used to wait for events - now deprecated
# since each new active call gets its own separately
# @param creds [Core::ChannelCredentials|Symbol] the channel credentials, or # @param creds [Core::ChannelCredentials|Symbol] the channel credentials, or
# :this_channel_is_insecure # :this_channel_is_insecure
# @param channel_override [Core::Channel] a pre-created channel # @param channel_override [Core::Channel] a pre-created channel
@ -97,7 +98,6 @@ module GRPC
propagate_mask: nil, propagate_mask: nil,
**kw) **kw)
fail(TypeError, '!CompletionQueue') unless q.is_a?(Core::CompletionQueue) fail(TypeError, '!CompletionQueue') unless q.is_a?(Core::CompletionQueue)
@queue = q
@ch = ClientStub.setup_channel(channel_override, host, creds, **kw) @ch = ClientStub.setup_channel(channel_override, host, creds, **kw)
alt_host = kw[Core::Channel::SSL_TARGET] alt_host = kw[Core::Channel::SSL_TARGET]
@host = alt_host.nil? ? host : alt_host @host = alt_host.nil? ? host : alt_host
@ -458,14 +458,17 @@ module GRPC
if deadline.nil? if deadline.nil?
deadline = from_relative_time(timeout.nil? ? @timeout : timeout) deadline = from_relative_time(timeout.nil? ? @timeout : timeout)
end end
call = @ch.create_call(@queue, # Provide each new client call with its own completion queue
call_queue = Core::CompletionQueue.new
call = @ch.create_call(call_queue,
parent, # parent call parent, # parent call
@propagate_mask, # propagation options @propagate_mask, # propagation options
method, method,
nil, # host use nil, nil, # host use nil,
deadline) deadline)
call.set_credentials! credentials unless credentials.nil? call.set_credentials! credentials unless credentials.nil?
ActiveCall.new(call, @queue, marshal, unmarshal, deadline, started: false) ActiveCall.new(call, call_queue, marshal, unmarshal, deadline,
started: false)
end end
end end
end end

Loading…
Cancel
Save