Permalink
Browse files

Temporary logging

  • Loading branch information...
1 parent 76b59af commit 5f0aeb006940f1e5e781c3ae599f953e3101289d Evan Shaw committed Jul 11, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 ironmq.go
View
@@ -13,6 +13,8 @@ import (
"path"
"sync"
"time"
+
+ "github.com/iron-io/golog"
)
// Copied straight from Go's package rand since it's not exported.
@@ -80,6 +82,7 @@ func (c *Client) req(method, endpoint string, body []byte, data interface{}) err
resp, err = http.DefaultClient.Do(req)
if err != nil {
if err == io.EOF && eofCount < 3 {
+ golog.Debugln("Retrying because of EOF", eofCount)
eofCount++
req.Body = ioutil.NopCloser(bytes.NewBuffer(body))
continue
@@ -89,6 +92,7 @@ func (c *Client) req(method, endpoint string, body []byte, data interface{}) err
// ELB sometimes returns this when load is increasing; we retry
// with exponential backoff
if resp.StatusCode == http.StatusServiceUnavailable {
+ golog.Debugln("Retrying because of 503", tries)
tries++
// random delay between 0 and (4^tries*100) milliseconds
pow := int64(1) << (2 * tries) * 100

0 comments on commit 5f0aeb0

Please sign in to comment.