google-cloud-env 1.1.0 → 1.2.0
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 +4 -0
- data/lib/google/cloud/env.rb +11 -6
- data/lib/google/cloud/env/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: 3ef4d05db69a9e9b94528892fdbc6290b465ac045b1ab140c43682d8a0c96606
|
4
|
+
data.tar.gz: 76d191dc0d86415f21383217be630c81cb2ddd76cc091c65c17a72eb6e51aaaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 331c0562ed88b3e9cb0252e01c8b6126d20f714b329a16c1afdb8d26e2902682c4b577f8f1d3721300ab27a4c223ab11720a1afc5b92862594798fcc25895686
|
7
|
+
data.tar.gz: 5fdf10aa396e7d58396bc238f4888fe26f06d9dcd3254475f7bc9bf6aeb7fcf7568af0c7f46764e3dcda25c164ed9e712d8ea514ed71ca4674099f0005d9f69e
|
data/CHANGELOG.md
CHANGED
data/lib/google/cloud/env.rb
CHANGED
@@ -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
|
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]
|
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`
|
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
|
-
|
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
|
##
|
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.
|
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-
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|