Skip to content

Commit

Permalink
Better handling of retry issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zackbloom committed Jul 19, 2016
1 parent 6871262 commit 563122e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,10 @@ func uploadFile(bucket *s3.Bucket, reader io.Reader, dest string, includeHash bo
}

log.Printf("Uploading to %s in %s (%s) [%d]\n", dest, bucket.Name, hashPrefix, caching)
op := func() error {
// Copy the buffer so subsequent calls have something to read
buf := buffer

return bucket.PutReader(dest, buf, int64(len(data)), guessContentType(dest)+"; charset=utf-8", s3.PublicRead, s3Opts)
op := func() error {
// We need to create a new reader each time, as we might be doing this more than once (if it fails)
return bucket.PutReader(dest, bytes.NewReader(data), int64(len(data)), guessContentType(dest)+"; charset=utf-8", s3.PublicRead, s3Opts)
}

back := backoff.NewExponentialBackOff()
Expand Down

0 comments on commit 563122e

Please sign in to comment.