Skip to content

Commit ccd67b5

Browse files
dmichel1ajaaym
authored andcommitted
---
yaml --- r: 19883 b: refs/heads/autosynth-language c: 44db769 h: refs/heads/master i: 19881: c48f4bf 19879: 9947c8b
1 parent 1f5f697 commit ccd67b5

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
@@ -134,7 +134,7 @@ refs/heads/autosynth-errorreporting: 1101a04e8be074802c35332d5fcf8297f61cae32
134134
refs/heads/autosynth-firestore: d1a44f9acc302750e37b008ecb9c1aa535cc94df
135135
refs/heads/autosynth-iot: f03bdd338a9056ca3b7ea6d9ca901649ba9aab78
136136
refs/heads/autosynth-kms: 2828edfe3d2c53dd6e71912eae8a53c87bf40c87
137-
refs/heads/autosynth-language: d6b2c21e731a4307128d79d65daa64893e421a5a
137+
refs/heads/autosynth-language: 44db7693731df97d301be39001377ed9460b938c
138138
refs/heads/autosynth-os-login: a88a337797996a205873040a63abe1d3116f5789
139139
refs/heads/autosynth-redis: 0cdb2e47359d51b73763bcea8af3de62aa99119b
140140
refs/heads/autosynth-scheduler: d97f8743ba965c7d5e492c8dc1f51d023104e260

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