class Prefab::CancellableInterceptor
Constants
- WAIT_SEC
Public Class Methods
new(base_client)
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 5 def initialize(base_client) @base_client = base_client end
Public Instance Methods
bidi_streamer(requests:, call:, method:, metadata:, &block)
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 38 def bidi_streamer(requests:, call:, method:, metadata:, &block) shared(call, &block) end
cancel()
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 9 def cancel @call.instance_variable_get("@wrapped").instance_variable_get("@call").cancel i = 0 while (i < WAIT_SEC) do if @call.instance_variable_get("@wrapped").cancelled? @base_client.log_internal Logger::DEBUG, "Cancelled streaming." return else @base_client.log_internal Logger::DEBUG, "Unable to cancel streaming. Trying again" @call.instance_variable_get("@wrapped").instance_variable_get("@call").cancel i += 1 sleep(1) end end @base_client.log_internal Logger::INFO, "Unable to cancel streaming." end
client_streamer(requests:, call:, method:, metadata:, &block)
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 30 def client_streamer(requests:, call:, method:, metadata:, &block) shared(call, &block) end
request_response(request:, call:, method:, metadata:, &block)
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 26 def request_response(request:, call:, method:, metadata:, &block) shared(call, &block) end
server_streamer(request:, call:, method:, metadata:, &block)
click to toggle source
# File lib/prefab/cancellable_interceptor.rb, line 34 def server_streamer(request:, call:, method:, metadata:, &block) shared(call, &block) end