aws/aws-sdk-net — pull request #79 by cankoluman (2014-03-04 12:49:32+00:00)
Title: Dev/ck 1 bucket exists times out

This fix applies to the v1 SDK which is still heavily in use.

When 'DoesS3BucketExist' is called in rapid succession, the web response times out. Then the function returns 'false' even when the bucket exists. These small changes resolve the timeout issue.

Test Example:
[Test]
public void EnsureBucketExists_DoesNot_TimeOut()
{
var timer = Stopwatch.StartNew();
try
{
for (var i = 0; i < 5; i++)
{
var result = AmazonS3Util.DoesS3BucketExist(Bucket, _amazonS3);
//we are running with an existing bucket
Assert.IsTrue(result);
System.Threading.Thread.Sleep(1000);
}
}
catch (Exception e)
{

}
finally
{
timer.Stop();
var elapsedTime = timer.Elapsed.TotalMilliseconds;

Assert.IsTrue(elapsedTime < (WebRequest.Create("http://test.com") as HttpWebRequest).Timeout);
}
}
}