google-cloud-env 2.0.1 → 2.1.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 +6 -0
- data/lib/google/cloud/env/compute_metadata.rb +14 -7
- data/lib/google/cloud/env/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86778304c7001d745acd20f90528b22a5e03c2c048f522cedd8e99ab1f50bf24
|
4
|
+
data.tar.gz: '05291246aa4fb33c473f2fa9bceefdc921460b4424174ef357707e07c2c832bc'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3900d323cdddef329f2edc4b17f7098dda5edac5378bfb11fc1311b23dc0680eb83d8f18bef86ad95baeb46315c7466551e7a0c5badf31924d3f6862ff05b1f5
|
7
|
+
data.tar.gz: 5ba1b0660ab4ee0e04f34cec0cee72ef3fda2fe7aa52e14dfb159db4c0a89d9cc38cf215d2606b900c1f0c25f9fc77d942b377ab678179859ac23be23dadfc5e
|
data/CHANGELOG.md
CHANGED
@@ -89,7 +89,8 @@ module Google
|
|
89
89
|
# {ComputeMetadata#lookup_response}.
|
90
90
|
#
|
91
91
|
# This object duck-types the `status`, `body`, and `headers` fields of
|
92
|
-
# `Faraday::Response`.
|
92
|
+
# `Faraday::Response`. It also includes the CLOCK_MONOTONIC time when
|
93
|
+
# the data was retrieved.
|
93
94
|
#
|
94
95
|
class Response
|
95
96
|
##
|
@@ -105,6 +106,7 @@ module Google
|
|
105
106
|
@status = status
|
106
107
|
@body = body
|
107
108
|
@headers = headers
|
109
|
+
@retrieval_monotonic_time = Process.clock_gettime Process::CLOCK_MONOTONIC
|
108
110
|
end
|
109
111
|
|
110
112
|
##
|
@@ -125,6 +127,11 @@ module Google
|
|
125
127
|
#
|
126
128
|
attr_reader :headers
|
127
129
|
|
130
|
+
# The CLOCK_MONOTONIC time at which this response was retrieved.
|
131
|
+
# @return [Numeric]
|
132
|
+
#
|
133
|
+
attr_reader :retrieval_monotonic_time
|
134
|
+
|
128
135
|
##
|
129
136
|
# Returns true if the metadata-flavor is correct for Google Cloud
|
130
137
|
# @return [boolean]
|
@@ -752,9 +759,9 @@ module Google
|
|
752
759
|
end
|
753
760
|
response = Response.new http_response.status, http_response.body, http_response.headers
|
754
761
|
if path.nil?
|
755
|
-
post_update_existence(response.status == 200 && response.google_flavor
|
762
|
+
post_update_existence(response.status == 200 && response.google_flavor?, response.retrieval_monotonic_time)
|
756
763
|
elsif response.google_flavor?
|
757
|
-
post_update_existence true
|
764
|
+
post_update_existence true, response.retrieval_monotonic_time
|
758
765
|
end
|
759
766
|
lifetime = determine_data_lifetime path, response.body.strip
|
760
767
|
LazyValue.expiring_value lifetime, response
|
@@ -767,14 +774,14 @@ module Google
|
|
767
774
|
# @private
|
768
775
|
# Update existence based on a received result
|
769
776
|
#
|
770
|
-
def post_update_existence success
|
777
|
+
def post_update_existence success, current_time = nil
|
771
778
|
return if @existence == :confirmed
|
772
779
|
@mutex.synchronize do
|
773
780
|
if success
|
774
781
|
@existence = :confirmed
|
775
|
-
elsif @existence != :confirmed
|
776
|
-
|
777
|
-
@existence = :no
|
782
|
+
elsif @existence != :confirmed
|
783
|
+
current_time ||= Process.clock_gettime Process::CLOCK_MONOTONIC
|
784
|
+
@existence = :no if current_time > @startup_time + warmup_time
|
778
785
|
end
|
779
786
|
end
|
780
787
|
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: 2.0
|
4
|
+
version: 2.1.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: 2023-12-
|
11
|
+
date: 2023-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -59,10 +59,10 @@ homepage: https://github.com/googleapis/ruby-cloud-env
|
|
59
59
|
licenses:
|
60
60
|
- Apache-2.0
|
61
61
|
metadata:
|
62
|
-
changelog_uri: https://rubydoc.info/gems/google-cloud-env/2.0
|
62
|
+
changelog_uri: https://rubydoc.info/gems/google-cloud-env/2.1.0/CHANGELOG.md
|
63
63
|
source_code_uri: https://github.com/googleapis/ruby-cloud-env
|
64
64
|
bug_tracker_uri: https://github.com/googleapis/ruby-cloud-env/issues
|
65
|
-
documentation_uri: https://rubydoc.info/gems/google-cloud-env/2.0
|
65
|
+
documentation_uri: https://rubydoc.info/gems/google-cloud-env/2.1.0
|
66
66
|
post_install_message:
|
67
67
|
rdoc_options: []
|
68
68
|
require_paths:
|