Class: RPCBench::GRPC::Client
- Inherits:
-
Driver
- Object
- Driver
- RPCBench::GRPC::Client
show all
- Defined in:
- lib/rpc_bench/driver_grpc.rb
Instance Method Summary
collapse
Methods inherited from Driver
#close, #send, #set_handler
Constructor Details
#initialize(opts) ⇒ Client
Returns a new instance of Client.
42
43
44
|
# File 'lib/rpc_bench/driver_grpc.rb', line 42
def initialize opts
@opts = opts
end
|
Instance Method Details
#send_request(data, count) ⇒ Object
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/rpc_bench/driver_grpc.rb', line 58
def send_request(data, count)
stub = RPCBench::GRPC::Calc::Stub.new("#{@opts[:host]}:#{@opts[:port]}", :this_channel_is_insecure)
results = []
(1..count).each do |_|
results << sendmsg(stub, data)
end
results
end
|
#sendmsg(stub, data) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/rpc_bench/driver_grpc.rb', line 46
def sendmsg stub, data
begin
stub.calc_tmp(RPCBench::GRPC::TmpRequest.new(num: data)).num
rescue ::GRPC::BadStatus => e
if(e.code == 8)
sendmsg stub, data
else
puts "[warning] other error is occurrs"
end
end
end
|