Skip to content

Commit cbf4568

Browse files
dmichel1ajaaym
authored andcommitted
---
yaml --- r: 13625 b: refs/heads/autosynth-dlp c: 44db769 h: refs/heads/master i: 13623: 062afab
1 parent 8545a8f commit cbf4568

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ refs/tags/v0.60.0: 4cd518d0612329f8a8e53484eef4cd1651e32855
104104
refs/tags/v0.61.0: e4b526656bb1bf5eefd0ee578b7405147821225e
105105
refs/tags/v0.62.0: bbede7385d48ba08f487bdd29ec10668ace96396
106106
refs/heads/0.60.0-alpha: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
107-
refs/heads/autosynth-dlp: d6b2c21e731a4307128d79d65daa64893e421a5a
107+
refs/heads/autosynth-dlp: 44db7693731df97d301be39001377ed9460b938c
108108
refs/heads/autosynth-logging: f8794c50a64f62b167cddf42513d133547679e01
109109
refs/heads/dupes: 3478c5d81fd242d0e985656645a679420a2060c2
110110
refs/tags/v0.63.0: 94f19b71d40f46b36120e7b9d78a1a3d41bfcbd6

branches/autosynth-dlp/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/MetadataConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
public class MetadataConfig {
3535

3636
private static final String METADATA_URL = "http://metadata.google.internal/computeMetadata/v1/";
37+
private static final int TIMEOUT_MS = 5000;
3738

3839
private MetadataConfig() {}
3940

@@ -69,6 +70,8 @@ public static String getAttribute(String attributeName) {
6970
try {
7071
URL url = new URL(METADATA_URL + attributeName);
7172
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
73+
connection.setConnectTimeout(TIMEOUT_MS);
74+
connection.setReadTimeout(TIMEOUT_MS);
7275
connection.setRequestProperty("Metadata-Flavor", "Google");
7376
InputStream input = connection.getInputStream();
7477
if (connection.getResponseCode() == 200) {

0 commit comments

Comments
 (0)