google-cloud-env 1.1.0 → 1.2.0

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: cf38fd3f5bb159512f455fde243bd4c6f120535533c5762b92ba28f107fb69ca
4
- data.tar.gz: e989ea213443a933d3fa824fb23dc1a0c2e02e613936fe4e135aebc568aa1109
3
+ metadata.gz: 3ef4d05db69a9e9b94528892fdbc6290b465ac045b1ab140c43682d8a0c96606
4
+ data.tar.gz: 76d191dc0d86415f21383217be630c81cb2ddd76cc091c65c17a72eb6e51aaaf
5
5
  SHA512:
6
- metadata.gz: f0ce4b36dae87c5229eae4210e63487da960033430b47e11280cb4752da742d39d7dd3d24ed3cc7ea710124f75da0dbb7b8fa4e36a1ae29cce9f052e77c34100
7
- data.tar.gz: d24d266602fa82aba6a6a050f049470c9c85cf937b6e0bd58d804135881b889451219e90f2058b88a74cb67ca1b5741d9df31eeeff8ee8f56a601c82bdd4b4a6
6
+ metadata.gz: 331c0562ed88b3e9cb0252e01c8b6126d20f714b329a16c1afdb8d26e2902682c4b577f8f1d3721300ab27a4c223ab11720a1afc5b92862594798fcc25895686
7
+ data.tar.gz: 5fdf10aa396e7d58396bc238f4888fe26f06d9dcd3254475f7bc9bf6aeb7fcf7568af0c7f46764e3dcda25c164ed9e712d8ea514ed71ca4674099f0005d9f69e
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ### 1.2.0 / 2019-06-19
4
+
5
+ * Support separate timeout for connecting to the metadata server vs the entire request
6
+
3
7
  ### 1.1.0 / 2019-05-29
4
8
 
5
9
  * Support disabling of the metadata cache
@@ -78,14 +78,17 @@ module Google
78
78
  # Create a new instance of the environment information.
79
79
  # Most client should not need to call this directly. Obtain a singleton
80
80
  # instance of the information from `Google::Cloud.env`. This constructor
81
- # is provided for internal testing and allows mocking of the data.
81
+ # is provided to allow customization of the timeout/retry settings, as
82
+ # well as mocking for testing.
82
83
  #
83
84
  # @param [Hash] env Mock environment variables.
84
85
  # @param [Hash,false] metadata_cache The metadata cache. You may pass
85
86
  # a prepopuated cache, an empty cache (the default) or `false` to
86
87
  # disable the cache completely.
87
- # @param [Numeric] request_timeout Timeout for each http request.
88
+ # @param [Numeric] open_timeout Timeout for opening http connections.
88
89
  # Defaults to 0.1.
90
+ # @param [Numeric] request_timeout Timeout for entire http requests.
91
+ # Defaults to 1.0.
89
92
  # @param [Integer] retry_count Number of times to retry http requests.
90
93
  # Defaults to 1. Note that retry remains in effect even if a custom
91
94
  # `connection` is provided.
@@ -96,10 +99,12 @@ module Google
96
99
  # @param [Numeric] retry_max_interval Maximum time between retries in
97
100
  # seconds. Defaults to 0.5.
98
101
  # @param [Faraday::Connection] connection Faraday connection to use.
99
- # If specified, overrides the `request_timeout` setting.
102
+ # If specified, overrides the `request_timeout` and `open_timeout`
103
+ # settings.
100
104
  #
101
105
  def initialize env: nil, connection: nil, metadata_cache: nil,
102
- request_timeout: 0.1, retry_count: 2, retry_interval: 0.1,
106
+ open_timeout: 0.1, request_timeout: 1.0,
107
+ retry_count: 2, retry_interval: 0.1,
103
108
  retry_backoff_factor: 1.5, retry_max_interval: 0.5
104
109
  @disable_metadata_cache = metadata_cache == false
105
110
  @metadata_cache = metadata_cache || {}
@@ -108,9 +113,9 @@ module Google
108
113
  @retry_interval = retry_interval
109
114
  @retry_backoff_factor = retry_backoff_factor
110
115
  @retry_max_interval = retry_max_interval
116
+ request_opts = { timeout: request_timeout, open_timeout: open_timeout }
111
117
  @connection = connection ||
112
- ::Faraday.new(url: METADATA_HOST,
113
- request: { timeout: request_timeout })
118
+ ::Faraday.new(url: METADATA_HOST, request: request_opts)
114
119
  end
115
120
 
116
121
  ##
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  class Env
19
- VERSION = "1.1.0".freeze
19
+ VERSION = "1.2.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-05 00:00:00.000000000 Z
11
+ date: 2019-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday