Zi/disable dead loop retry (#175)

* disable endless retry logic

- we should do the retry logic at application cmd/ro, cmd/ro will need to
  deal with keyboard interrupts as well

* update test self-signed certificate with a expiry of 100 years

* ro tool supports retries after getting delegation errors
This commit is contained in:
Zi Lin
2016-10-17 15:19:30 -07:00
committed by Kyle Isom
parent 70d3edbf9d
commit 78e9720635
7 changed files with 64 additions and 39 deletions
+3 -14
View File
@@ -8,11 +8,8 @@ import (
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/cloudflare/backoff"
"github.com/cloudflare/redoctober/core"
)
@@ -62,17 +59,9 @@ func (c *RemoteServer) getURL(path string) string {
func (c *RemoteServer) doAction(action string, req []byte) ([]byte, error) {
buf := bytes.NewBuffer(req)
url := c.getURL("/" + action)
b := backoff.Backoff{}
var resp *http.Response
var err error
for {
resp, err = c.client.Post(url, "application/json", buf)
if err == nil {
break
}
delay := b.Duration()
log.Printf("Request to server failed. Will try again in %s", delay)
<-time.After(delay)
resp, err := c.client.Post(url, "application/json", buf)
if err != nil {
return nil, err
}
body, err := ioutil.ReadAll(resp.Body)