Skip to content

Commit 9929e7e

Browse files
dmichel1ajaaym
authored andcommitted
---
yaml --- r: 20307 b: refs/heads/autosynth-scheduler c: 44db769 h: refs/heads/master i: 20305: 1e8015d 20303: c2f1f97
1 parent cad8ce5 commit 9929e7e

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
@@ -137,7 +137,7 @@ refs/heads/autosynth-kms: 2828edfe3d2c53dd6e71912eae8a53c87bf40c87
137137
refs/heads/autosynth-language: c3d990dd34d81e7e935041e7147fb9dd27f8a557
138138
refs/heads/autosynth-os-login: 092fdbed6d5317948f92b708e9f50dedd89fc666
139139
refs/heads/autosynth-redis: 9e1fe503973c7b4a9ba26afb1fcddc2a57ba795a
140-
refs/heads/autosynth-scheduler: d6b2c21e731a4307128d79d65daa64893e421a5a
140+
refs/heads/autosynth-scheduler: 44db7693731df97d301be39001377ed9460b938c
141141
refs/heads/autosynth-spanner: 9bff86d057df31e04c76d72865e8e073ac5794fb
142142
refs/heads/autosynth-speech: 75d6c62a9d07d3a3642980502a25d07fbde0f232
143143
refs/heads/autosynth-tasks: b0cdb991f3f75345151a3f68db1aab273dfc069b

branches/autosynth-scheduler/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)