A bit more verbose

This commit is contained in:
Audrius Butkevicius 2015-09-21 22:33:29 +01:00
parent 0e2132ad3e
commit 87cc2d2313

View File

@ -13,6 +13,9 @@ import (
) )
func poolHandler(pool string, uri *url.URL) { func poolHandler(pool string, uri *url.URL) {
if debug {
log.Println("Joining", pool)
}
for { for {
var b bytes.Buffer var b bytes.Buffer
json.NewEncoder(&b).Encode(struct { json.NewEncoder(&b).Encode(struct {
@ -54,13 +57,11 @@ func poolHandler(pool string, uri *url.URL) {
err := json.NewDecoder(resp.Body).Decode(&x) err := json.NewDecoder(resp.Body).Decode(&x)
if err == nil { if err == nil {
rejoin := x.EvictionIn - (x.EvictionIn / 5) rejoin := x.EvictionIn - (x.EvictionIn / 5)
if debug {
log.Println("Joined", pool, "rejoining in", rejoin) log.Println("Joined", pool, "rejoining in", rejoin)
}
time.Sleep(rejoin) time.Sleep(rejoin)
continue continue
} else if debug { } else if debug {
log.Println("Failed to deserialize respnse", err) log.Println("Failed to deserialize response", err)
} }
} }
time.Sleep(time.Hour) time.Sleep(time.Hour)