Class: SlowService

Inherits:
Object
  • Object
show all
Includes:
GRPC::GenericService
Defined in:
src/ruby/spec/generic/rpc_server_spec.rb

Overview

A slow test service.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GRPC::GenericService

included, underscore

Constructor Details

#initialize(_default_var = 'ignored') ⇒ SlowService


114
115
116
117
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 114

def initialize(_default_var = 'ignored')
  @delay = 0.25
  @received_md = []
end

Instance Attribute Details

#delayObject (readonly)

Returns the value of attribute delay


112
113
114
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 112

def delay
  @delay
end

#received_mdObject (readonly)

Returns the value of attribute received_md


112
113
114
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 112

def received_md
  @received_md
end

Instance Method Details

#an_rpc(req, call) ⇒ Object


119
120
121
122
123
124
# File 'src/ruby/spec/generic/rpc_server_spec.rb', line 119

def an_rpc(req, call)
  GRPC.logger.info("starting a slow #{@delay} rpc")
  sleep @delay
  @received_md << call. unless call..nil?
  req  # send back the req as the response
end