Method: Gruf::SynchronizedClient#initialize

Defined in:
lib/gruf/synchronized_client.rb

#initialize(service:, options: {}, client_options: {}) ⇒ SynchronizedClient

Initialize the client and setup the stub

Options Hash (options:):

  • :unsynchronized_methods (Array)

    A list of methods (as symbols) that should be excluded from synchronization

  • :internal_cache_expiry (Integer)

    The length of time to keep results around for other threads to fetch (in seconds)

Parameters:

  • The namespace of the client Stub that is desired to load

  • (defaults to: {})

    A hash of options for the client

  • (defaults to: {})

    A hash of options to pass to the gRPC client stub



39
40
41
42
43
44
45
# File 'lib/gruf/synchronized_client.rb', line 39

def initialize(service:, options: {}, client_options: {})
  @unsynchronized_methods = options.delete(:unsynchronized_methods) { [] }
  @expiry = options.delete(:internal_cache_expiry) { Gruf.synchronized_client_internal_cache_expiry }
  @locks = Concurrent::Map.new
  @results = Concurrent::Map.new
  super
end