istox 0.1.152 → 0.1.152.1.test1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9f8c22d6d954148aca8c358595d52a2e6d8aba0f8656d82673fdcb648151827
4
- data.tar.gz: 2a8423bc446aa0b3bef4595f66786bb938545899431c059561b9558d082a48b3
3
+ metadata.gz: 8de85d6ec6459e8ca05fed0aef86d9c017a233dde008834d6f07aab319351ea2
4
+ data.tar.gz: c3bdf57b55f75e77b0cdadd886afd93d8ca6d0f32af876f985f42352544113e1
5
5
  SHA512:
6
- metadata.gz: 79782b80f435a7bd4d937fbc7fc962a8fa0979ed32d22d9daf440637f7055360ca97690fa671e71c8166307b6eee170d7edf857d0119399a542652b6286039f8
7
- data.tar.gz: f6d5fa2a75b0dcf74632d2fe8e36e0ed78eb5e8ca8001715ed66f6b7c0442ead379fe39c650fc66a311eb43714e5919888bd7f576baacecbe9cdb2ad7b123cf0
6
+ metadata.gz: 91672f39e69a4cf382c2dbc9488b882b883d959e55e1a7c8d7c7a7490490656696fae2613bf53d3ddac424da2b5d56f72eb10bbca08471cd48566909874dc32d
7
+ data.tar.gz: d96255c35015f00565851d8f83c810776ae93ac2e1ebe93fc6af410a277b35a6fd2e7eb118463d394c1b9891d50dae8ff90d9cb4585791e8f8206735aabb25da
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- istox (0.1.150.1)
4
+ istox (0.1.152)
5
5
  awesome_print
6
6
  binding_of_caller
7
7
  bunny (>= 2.12.0)
@@ -65,7 +65,7 @@ GEM
65
65
  arel (9.0.0)
66
66
  awesome_print (1.8.0)
67
67
  aws-eventstream (1.1.0)
68
- aws-sigv4 (1.1.3)
68
+ aws-sigv4 (1.1.1)
69
69
  aws-eventstream (~> 1.0, >= 1.0.2)
70
70
  binding_of_caller (0.8.0)
71
71
  debug_inspector (>= 0.0.1)
@@ -98,18 +98,18 @@ GEM
98
98
  ffi (1.12.2)
99
99
  globalid (0.4.2)
100
100
  activesupport (>= 4.2.0)
101
- google-protobuf (3.11.4)
101
+ google-protobuf (3.11.4-universal-darwin)
102
102
  googleapis-common-protos-types (1.0.5)
103
103
  google-protobuf (~> 3.11)
104
104
  graphlient (0.3.7)
105
105
  faraday
106
106
  faraday_middleware
107
107
  graphql-client
108
- graphql (1.10.8)
108
+ graphql (1.10.6)
109
109
  graphql-client (0.16.0)
110
110
  activesupport (>= 3.0)
111
111
  graphql (~> 1.8)
112
- grpc (1.28.0)
112
+ grpc (1.28.0-universal-darwin)
113
113
  google-protobuf (~> 3.11)
114
114
  googleapis-common-protos-types (~> 1.0)
115
115
  grpc-tools (1.28.0)
@@ -9,12 +9,25 @@ module Istox
9
9
  @@hosts[host_type] = url
10
10
  end
11
11
 
12
- def call(host_type, service, method, **keyword_args)
12
+ def add_interceptors(interceptor)
13
+ @@interceptors = [] unless defined?(@@interceptors)
14
+
15
+ @@interceptors.push(interceptor)
16
+ end
17
+
18
+ def call(host_type, service, method, grpc_retries_count: 1, **keyword_args)
13
19
  execute(host_type, service, method, **keyword_args)
14
- # rescue => e
15
- # reinitiate service and try again, second chance
16
- # reinitiate_service(host_type, service)
17
- # execute(host_type, service, method, **keyword_args)
20
+ rescue Gruf::Client::Errors::Unavailable => e
21
+ # will retry three times with 1 seconds sleep between if there is a Unavailable error thrown from GRPC
22
+ if grpc_retries_count < 3
23
+ log.warn "GRPC failed to connect to #{host_type}, retrying after 1 seconds, retry count: #{grpc_retries_count}/3"
24
+ sleep 1
25
+ reinitiate_service(host_type, service)
26
+ call(host_type, service, method, grpc_retries_count: grpc_retries_count + 1, **keyword_args)
27
+ else
28
+ log.fatal "GRPC unable connect to #{host_type}, throwing exception now."
29
+ raise e
30
+ end
18
31
  end
19
32
 
20
33
  def default_channel_options
@@ -65,7 +78,7 @@ module Istox
65
78
 
66
79
  log.info 'Reinitiating to grpc host at ' + host_url
67
80
  t1 = Time.now
68
- @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: { hostname: host_url }, client_options: channel_options)
81
+ @@services[get_key(host_type, service)] = ::Gruf::Client.new(service: service, options: { hostname: host_url }, client_options: client_options)
69
82
  log.info "Time taken for reinitiating grpc host: #{Time.now - t1} seconds"
70
83
  end
71
84
 
@@ -73,8 +86,9 @@ module Istox
73
86
  host_type.to_s + service.to_s
74
87
  end
75
88
 
76
- def channel_options
89
+ def client_options
77
90
  {
91
+ interceptors: @@interceptors || [],
78
92
  channel_args: default_channel_options
79
93
  }
80
94
  end
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.152'.freeze
2
+ VERSION = '0.1.152.1.test1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.152
4
+ version: 0.1.152.1.test1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -471,9 +471,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
471
471
  version: '0'
472
472
  required_rubygems_version: !ruby/object:Gem::Requirement
473
473
  requirements:
474
- - - ">="
474
+ - - ">"
475
475
  - !ruby/object:Gem::Version
476
- version: '0'
476
+ version: 1.3.1
477
477
  requirements: []
478
478
  rubygems_version: 3.0.6
479
479
  signing_key: