Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions s3-benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main

import (
"bytes"
"code.cloudfoundry.org/bytefmt"
"crypto/hmac"
"crypto/md5"
"crypto/sha1"
Expand All @@ -16,7 +17,6 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/pivotal-golang/bytefmt"
"io"
"io/ioutil"
"log"
Expand Down Expand Up @@ -193,7 +193,7 @@ func hmacSHA1(key []byte, content string) []byte {

func setSignature(req *http.Request) {
// Setup default parameters
dateHdr := time.Now().UTC().Format("20060102T150405Z")
dateHdr := time.Now().UTC().Format(time.RFC1123)
req.Header.Set("X-Amz-Date", dateHdr)
// Get the canonical resource and header
canonicalResource := req.URL.EscapedPath()
Expand All @@ -217,7 +217,7 @@ func runUpload(thread_num int) {
if resp, err := httpClient.Do(req); err != nil {
log.Fatalf("FATAL: Error uploading object %s: %v", prefix, err)
} else if resp != nil && resp.StatusCode != http.StatusOK {
if (resp.StatusCode == http.StatusServiceUnavailable) {
if resp.StatusCode == http.StatusServiceUnavailable {
atomic.AddInt32(&upload_slowdown_count, 1)
atomic.AddInt32(&upload_count, -1)
} else {
Expand Down Expand Up @@ -245,7 +245,7 @@ func runDownload(thread_num int) {
if resp, err := httpClient.Do(req); err != nil {
log.Fatalf("FATAL: Error downloading object %s: %v", prefix, err)
} else if resp != nil && resp.Body != nil {
if (resp.StatusCode == http.StatusServiceUnavailable){
if resp.StatusCode == http.StatusServiceUnavailable {
atomic.AddInt32(&download_slowdown_count, 1)
atomic.AddInt32(&download_count, -1)
} else {
Expand All @@ -270,7 +270,7 @@ func runDelete(thread_num int) {
setSignature(req)
if resp, err := httpClient.Do(req); err != nil {
log.Fatalf("FATAL: Error deleting object %s: %v", prefix, err)
} else if (resp != nil && resp.StatusCode == http.StatusServiceUnavailable) {
} else if resp != nil && resp.StatusCode == http.StatusServiceUnavailable {
atomic.AddInt32(&delete_slowdown_count, 1)
atomic.AddInt32(&delete_count, -1)
}
Expand Down