From db42c85360fa881bdfdb752b5b3a73ceb677cb6c Mon Sep 17 00:00:00 2001 From: Randall McPherson Date: Thu, 3 Apr 2014 15:28:52 -0400 Subject: [PATCH] Reduce instance metadata request timeout to 2 seconds. --- auth.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/auth.go b/auth.go index f2f5834..6cf0751 100644 --- a/auth.go +++ b/auth.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "net/http" "os" + "time" ) // Keys for an Amazon Web Services account. @@ -35,7 +36,7 @@ func InstanceKeys() (keys Keys, err error) { // request the role name for the instance // assumes there is only one - resp, err := http.Get(rolePath) + resp, err := ClientWithTimeout(2 * time.Second).Get(rolePath) if err != nil { return }