gruf 2.9.0 → 2.9.1
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/CHANGELOG.md +5 -0
- data/lib/gruf/client.rb +23 -1
- data/lib/gruf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bffd546b0bd27dcd8cd54146065623e73e0396211ae263985a197255bb8ec48a
|
4
|
+
data.tar.gz: 9b0364643ab5c1008a330ed61c8fba4458f9b075c34eea81acb10de4ee70f53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef4637ca552b572f77b270ccdc491c660b62d7c1d8ff85fe67151cf22f09e92f18a9b88b63d31e956411cb46380ba695e0eccc74d47a2095c8fc7d6ebfaf838
|
7
|
+
data.tar.gz: 0f38cc6c69487f1cab2ebc5e07b5a06de20f5e35d0000ad4c80a021288557aaaef2acf58fe254be6dc292ddd2e764976acfdd65578a7a0233c663dea83018eb3
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 2.9.1
|
6
|
+
|
7
|
+
- Drop support for Ruby 2.4/2.5 to align with Ruby EOL schedule, supporting 2.6+ only
|
8
|
+
- Allow for float/TimeSpec timeout values on clients
|
9
|
+
|
5
10
|
### 2.9.0
|
6
11
|
|
7
12
|
- Change to racially neutral terminology across library
|
data/lib/gruf/client.rb
CHANGED
@@ -62,7 +62,7 @@ module Gruf
|
|
62
62
|
@opts[:hostname] = @opts.fetch(:hostname, Gruf.default_client_host)
|
63
63
|
@opts[:channel_credentials] = @opts.fetch(:channel_credentials, Gruf.default_channel_credentials)
|
64
64
|
@error_factory = Gruf::Client::ErrorFactory.new
|
65
|
-
client_options[:timeout] = client_options[:timeout]
|
65
|
+
client_options[:timeout] = parse_timeout(client_options[:timeout]) if client_options.key?(:timeout)
|
66
66
|
client = "#{service}::Stub".constantize.new(@opts[:hostname], build_ssl_credentials, **client_options)
|
67
67
|
super(client)
|
68
68
|
end
|
@@ -216,5 +216,27 @@ module Gruf
|
|
216
216
|
Gruf::Serializers::Errors::Json
|
217
217
|
end
|
218
218
|
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Handle various timeout values and prevent improper value setting
|
222
|
+
#
|
223
|
+
# @see GRPC::Core::TimeConsts#from_relative_time
|
224
|
+
# @param [mixed] timeout
|
225
|
+
# @return [Float]
|
226
|
+
# @return [GRPC::Core::TimeSpec]
|
227
|
+
#
|
228
|
+
def parse_timeout(timeout)
|
229
|
+
if timeout.nil?
|
230
|
+
GRPC::Core::TimeConsts::ZERO
|
231
|
+
elsif timeout.is_a?(GRPC::Core::TimeSpec)
|
232
|
+
timeout
|
233
|
+
elsif timeout.is_a?(Numeric)
|
234
|
+
timeout
|
235
|
+
elsif timeout.respond_to?(:to_f)
|
236
|
+
timeout.to_f
|
237
|
+
else
|
238
|
+
raise ArgumentError, 'timeout is not a valid value: does not respond to to_f'
|
239
|
+
end
|
240
|
+
end
|
219
241
|
end
|
220
242
|
end
|
data/lib/gruf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|