istox 0.1.152.1.test2 → 0.1.152.1.test3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/istox/helpers/grpc_client.rb +13 -1
- data/lib/istox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 758fc766dfc65e9d4d0b23738b9b307cdcb236a6c285026b31547c90bfa394df
|
4
|
+
data.tar.gz: 5be8eb757880769faa79f50a946639a5887b665331c67840d7cf7201941b9068
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531d98e17c4ed0ab48abbd6117175874ca3a8c8dc13b4bcc065987f2b100a7157f96191dadcee1438851560ae85615b861d2c59c816e849ffdf8f1670d05f36a
|
7
|
+
data.tar.gz: 7f87201248c55674239a2a86b0bd4b195e9ef29e696924ac7abe9d61be7409b9fd93e5d6efea9e6cfd5195e5d6bbb5b5ca86afa9978df0dbdaf93e41ad0a4c1f
|
@@ -3,6 +3,8 @@ require 'istox/helpers/logger'
|
|
3
3
|
module Istox
|
4
4
|
class GrpcClient
|
5
5
|
class << self
|
6
|
+
attr_accessor :client_metadata_hook
|
7
|
+
|
6
8
|
def add_host(host_type, url)
|
7
9
|
@@hosts = {} unless defined?(@@hosts)
|
8
10
|
|
@@ -48,7 +50,7 @@ module Istox
|
|
48
50
|
log.info "Calling method in grpc method: #{method.inspect}, params: #{keyword_args.inspect}"
|
49
51
|
t1 = Time.now
|
50
52
|
|
51
|
-
result = get_host(host_type, service).call(method, keyword_args)
|
53
|
+
result = get_host(host_type, service).call(method, keyword_args, client_metadata)
|
52
54
|
log.info "Time taken for grpc execution: #{Time.now - t1} seconds"
|
53
55
|
|
54
56
|
return_values = ::Istox::CommonHelper.to_open_struct(result.message)
|
@@ -94,6 +96,16 @@ module Istox
|
|
94
96
|
channel_args: default_channel_options
|
95
97
|
}
|
96
98
|
end
|
99
|
+
|
100
|
+
def client_metadata
|
101
|
+
return {} if @client_metadata_hook.blank?
|
102
|
+
|
103
|
+
unless @client_metadata_hook.methods.include?(:inject_metadata)
|
104
|
+
raise StandardError, 'Unable to find method .inject_metadata, have you forgotten to define it in your hook?'
|
105
|
+
end
|
106
|
+
|
107
|
+
@client_metadata_hook.inject_metadata
|
108
|
+
end
|
97
109
|
end
|
98
110
|
end
|
99
111
|
end
|
data/lib/istox/version.rb
CHANGED