google-gax 0.8.6 → 0.8.7

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
  SHA1:
3
- metadata.gz: f71e32189b1fb624d4eea6c700022151e4e94134
4
- data.tar.gz: 5885fdf6ce17d16932c891b3677cf60a6b30f574
3
+ metadata.gz: 716e8277e7cc5439a3f53c73c6cde2a8299ece01
4
+ data.tar.gz: ddb28ab9299ec05325ca30cdd40d13b5791d03f1
5
5
  SHA512:
6
- metadata.gz: 251e5b49190d51b23dca1350d45300687ec8b41c632df5f62198385223f25f7391f828cc5475d7ccd15847b0245128cab5b919494bb9fc6a5cbfc6671eb63a16
7
- data.tar.gz: f8a733a59af40210710c1e1661fc5ef88692178799b37fe5d8f404e120159a461e8cf68a28fb69877dced9190a4cd8c07e965b11707083530574563bbcf0c063
6
+ metadata.gz: 7b39b230f9fe8cd4eb4ce9a37f1b5290a2f616e05fa0a646b56287ae9a56f0543687a987db3fa1ec0996cbece43f67cb0cd957d68167c80e8f7b3faa1b035550
7
+ data.tar.gz: b74ca9b64dcf91794360de8b7055f10f4a70cce756629298fb75273b2e73004c362609b07067e30eeab5765365dde23ddded22775898d4f70d8fe8da68f9ede8
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
@@ -32,8 +32,6 @@ require 'time'
32
32
  require 'google/gax/errors'
33
33
  require 'google/gax/bundling'
34
34
 
35
- # rubocop:disable Metrics/ModuleLength
36
-
37
35
  module Google
38
36
  module Gax
39
37
  # A class to provide the Enumerable interface for page-streaming method.
@@ -246,21 +244,9 @@ module Google
246
244
  add_timeout_arg(func, this_settings.timeout,
247
245
  this_settings.kwargs)
248
246
  end
249
- api_call = catch_errors(api_call, settings.errors)
250
- api_caller.call(api_call, request, this_settings)
251
- end
252
- end
253
-
254
- # Updates a_func to wrap exceptions with GaxError
255
- #
256
- # @param a_func [Proc]
257
- # @param errors [Array<Exception>] Configures the exceptions to wrap.
258
- # @return [Proc] A proc that will wrap certain exceptions with GaxError.
259
- def catch_errors(a_func, errors)
260
- proc do |request|
261
247
  begin
262
- a_func.call(request)
263
- rescue *errors
248
+ api_caller.call(api_call, request, this_settings)
249
+ rescue *settings.errors
264
250
  raise GaxError, 'RPC failed'
265
251
  end
266
252
  end
@@ -312,8 +298,6 @@ module Google
312
298
  enumerable.method(:start)
313
299
  end
314
300
 
315
- # rubocop:disable Metrics/MethodLength
316
-
317
301
  # Creates a proc equivalent to a_func, but that retries on certain
318
302
  # exceptions.
319
303
  #
@@ -336,29 +320,24 @@ module Google
336
320
  delay = retry_options.backoff_settings.initial_retry_delay_millis
337
321
  timeout = (retry_options.backoff_settings.initial_rpc_timeout_millis /
338
322
  MILLIS_PER_SECOND)
339
- result = nil
340
- now = Time.now
341
- deadline = now + total_timeout
342
- loop do
343
- begin
344
- result = add_timeout_arg(a_func, timeout, kwargs).call(request)
345
- break
346
- rescue => exception
347
- unless exception.respond_to?(:code) &&
348
- retry_options.retry_codes.include?(exception.code)
349
- raise RetryError, 'Exception occurred in retry method that ' \
350
- 'was not classified as transient'
351
- end
352
- sleep(rand(delay) / MILLIS_PER_SECOND)
353
- now = Time.now
354
- delay = [delay * delay_mult, max_delay].min
355
- timeout = [timeout * timeout_mult, max_timeout, deadline - now].min
356
- if now >= deadline
357
- raise RetryError, 'Retry total timeout exceeded with exception'
358
- end
323
+ deadline = Time.now + total_timeout
324
+ begin
325
+ a_func.call(request, deadline: Time.now + timeout, metadata: kwargs)
326
+ rescue => exception
327
+ unless exception.respond_to?(:code) &&
328
+ retry_options.retry_codes.include?(exception.code)
329
+ raise RetryError, 'Exception occurred in retry method that ' \
330
+ 'was not classified as transient'
331
+ end
332
+ sleep(rand(delay) / MILLIS_PER_SECOND)
333
+ now = Time.now
334
+ delay = [delay * delay_mult, max_delay].min
335
+ timeout = [timeout * timeout_mult, max_timeout, deadline - now].min
336
+ if now >= deadline
337
+ raise RetryError, 'Retry total timeout exceeded with exception'
359
338
  end
339
+ retry
360
340
  end
361
- result
362
341
  end
363
342
  end
364
343
 
@@ -377,9 +356,9 @@ module Google
377
356
  end
378
357
  end
379
358
 
380
- module_function :create_api_call, :catch_errors, :bundleable,
359
+ module_function :create_api_call, :bundleable,
381
360
  :page_streamable, :retryable, :add_timeout_arg
382
- private_class_method :catch_errors, :bundleable, :page_streamable,
361
+ private_class_method :bundleable, :page_streamable,
383
362
  :retryable, :add_timeout_arg
384
363
  end
385
364
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -29,6 +29,6 @@
29
29
 
30
30
  module Google
31
31
  module Gax
32
- VERSION = '0.8.6'.freeze
32
+ VERSION = '0.8.7'.freeze
33
33
  end
34
34
  end
@@ -80,6 +80,7 @@ module Google
80
80
  # The scopes needed to make gRPC calls to all of the methods defined in
81
81
  # this service.
82
82
  ALL_SCOPES = [
83
+ "https://www.googleapis.com/auth/cloud-platform",
83
84
  ].freeze
84
85
 
85
86
  # @param service_path [String]
@@ -142,7 +143,7 @@ module Google
142
143
  warn "`app_name` and `app_version` are no longer being used in the request headers."
143
144
  end
144
145
 
145
- credentials ||= Google::Gax::Credentials.default
146
+ credentials ||= Google::Gax::Credentials.default(scope: scopes)
146
147
 
147
148
  if credentials.is_a?(String) || credentials.is_a?(Hash)
148
149
  updater_proc = Google::Gax::Credentials.new(credentials).updater_proc
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-gax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google API Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: googleauth