crowdmob/goamz — pull request #68 by kcaffrey (2014-01-13 22:24:25+00:00)
Title: Add a mechanism for specifying timeouts when making calls to S3

I was running into issues where connections to S3 would hang for long periods of time (possibly indefinite amounts of time). I wasn't sure this was the best way to implement supporting timeouts, but it works and is relatively simple.

My other idea was to put ConnectTimeout and ReadTimeout on a struct such as aws.Timeout, and create a function such as:

func (to *aws.Timeout) Do(request *http.Request)

Each component would then just have to add aws.Timeout to the main struct (in this case, S3), and replace http.DefaultClient.Do with s3.Timeout.Do.

The mechanism I implemented was lower impact however, and easily changed to the other implementation through a refactor if desired.