class SynchronizedCancellationService

A test service that allows a synchronized RPC cancellation

Attributes

delay[R]
received_md[R]

Public Class Methods

new(notify_request_received, wait_until_rpc_cancelled) click to toggle source

notify_request_received and wait_until_rpc_cancelled are callbacks to synchronously allow the client to proceed with cancellation (after the unary request has been received), and to synchronously wait until the client has cancelled the current RPC.

# File src/ruby/spec/generic/rpc_server_spec.rb, line 92
def initialize(notify_request_received, wait_until_rpc_cancelled)
  @notify_request_received = notify_request_received
  @wait_until_rpc_cancelled = wait_until_rpc_cancelled
end

Public Instance Methods

an_rpc(req, _call) click to toggle source
# File src/ruby/spec/generic/rpc_server_spec.rb, line 97
def an_rpc(req, _call)
  GRPC.logger.info('starting a synchronusly cancelled rpc')
  @notify_request_received.call(req)
  @wait_until_rpc_cancelled.call
  req  # send back the req as the response
end