diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-04-05 10:23:56 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-04-05 10:23:56 -0700 |
commit | 879a8f3bbadb091dc0e12010b26b3bc1917aee47 (patch) | |
tree | a99d1e1d92ec71b958e9782e976290dfb057fe08 | |
parent | 1b7c0a2c5cf27d7a77d9c3476fe6406a98ca3d76 (diff) | |
parent | 895c1113abe42a29f329cb4bcb9e908b36fc16b7 (diff) |
Merge pull request #6079 from murgatroid99/ruby_status_code_conformity
Make ruby library conform to status code spec
-rw-r--r-- | src/ruby/lib/grpc/generic/rpc_server.rb | 4 | ||||
-rw-r--r-- | src/ruby/spec/generic/rpc_server_spec.rb | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 4b5578b018..5ba77db173 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -403,7 +403,7 @@ module GRPC loop_handle_server_calls end - # Sends UNAVAILABLE if there are too many unprocessed jobs + # Sends RESOURCE_EXHAUSTED if there are too many unprocessed jobs def available?(an_rpc) jobs_count, max = @pool.jobs_waiting, @max_waiting_requests GRPC.logger.info("waiting: #{jobs_count}, max: #{max}") @@ -411,7 +411,7 @@ module GRPC GRPC.logger.warn("NOT AVAILABLE: too many jobs_waiting: #{an_rpc}") noop = proc { |x| x } c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline) - c.send_status(StatusCodes::UNAVAILABLE, '') + c.send_status(StatusCodes::RESOURCE_EXHAUSTED, '') nil end diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb index e16ba60387..e688057cb1 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -426,7 +426,7 @@ describe GRPC::RpcServer do threads.each(&:join) end - it 'should return UNAVAILABLE on too many jobs', server: true do + it 'should return RESOURCE_EXHAUSTED on too many jobs', server: true do opts = { a_channel_arg: 'an_arg', server_override: @server, @@ -449,7 +449,8 @@ describe GRPC::RpcServer do begin stub.an_rpc(req) rescue GRPC::BadStatus => e - one_failed_as_unavailable = e.code == StatusCodes::UNAVAILABLE + one_failed_as_unavailable = + e.code == StatusCodes::RESOURCE_EXHAUSTED end end end |