Class: Griffin::Interceptors::Server::TimeoutInterceptor

Inherits:
GRPC::ServerInterceptor
  • Object
show all
Defined in:
lib/griffin/interceptors/server/timeout_interceptor.rb

Constant Summary collapse

DEFAULT_TIMEOUT =
5

Instance Method Summary collapse

Constructor Details

#initialize(timeout = DEFAULT_TIMEOUT) ⇒ TimeoutInterceptor

Returns a new instance of TimeoutInterceptor.



11
12
13
# File 'lib/griffin/interceptors/server/timeout_interceptor.rb', line 11

def initialize(timeout = DEFAULT_TIMEOUT)
  @timeout = timeout
end

Instance Method Details

#request_responseObject



15
16
17
18
19
# File 'lib/griffin/interceptors/server/timeout_interceptor.rb', line 15

def request_response(*)
  Timeout.timeout(@timeout) do
    yield
  end
end