-
-
Save jcalvert/0c67997da37191f7b06fb26affdfce6b to your computer and use it in GitHub Desktop.
Failing greeter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this_dir = File.expand_path(File.dirname(__FILE__)) | |
lib_dir = File.join(this_dir, 'lib') | |
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) | |
require 'grpc' | |
require 'helloworld_services_pb' | |
def main | |
user = ARGV.size > 0 ? ARGV[0] : 'world' | |
sup = Time.now.to_f | |
stub = Helloworld::Greeter::Stub.new('www.example.com:2000', :this_channel_is_insecure) | |
100.times do |i| | |
start = Time.now.to_f | |
begin | |
message = stub.say_hello(Helloworld::HelloRequest.new(name: user), deadline: start+0.2).message | |
rescue => e | |
ensure | |
puts "Excessive Running time iteration #{i}!: #{Time.now.to_f - start}, total: #{sup-Time.now.to_f}" if (Time.now.to_f - start) > 1 | |
end | |
end | |
end | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment