[Ruby] set metadata_sent after call success (#33998)

fixes #25373
pull/33991/head
alto-ruby 1 year ago committed by GitHub
parent b4a39a2230
commit f3419f8373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/ruby/lib/grpc/generic/active_call.rb

@ -232,17 +232,16 @@ module GRPC
def server_unary_response(req, trailing_metadata: {}, def server_unary_response(req, trailing_metadata: {},
code: Core::StatusCodes::OK, details: 'OK') code: Core::StatusCodes::OK, details: 'OK')
ops = {} ops = {}
ops[SEND_MESSAGE] = @marshal.call(req)
ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
code, details, trailing_metadata)
ops[RECV_CLOSE_ON_SERVER] = nil
@send_initial_md_mutex.synchronize do @send_initial_md_mutex.synchronize do
ops[SEND_INITIAL_METADATA] = @metadata_to_send unless @metadata_sent ops[SEND_INITIAL_METADATA] = @metadata_to_send unless @metadata_sent
@metadata_sent = true @metadata_sent = true
end end
payload = @marshal.call(req)
ops[SEND_MESSAGE] = payload
ops[SEND_STATUS_FROM_SERVER] = Struct::Status.new(
code, details, trailing_metadata)
ops[RECV_CLOSE_ON_SERVER] = nil
@call.run_batch(ops) @call.run_batch(ops)
set_output_stream_done set_output_stream_done
end end

Loading…
Cancel
Save