Richard Crowley %!s(int64=13) %!d(string=hai) anos
pai
achega
1865fe70cd
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      graphite.go

+ 1 - 3
graphite.go

@@ -9,14 +9,11 @@ import (
 
 func Graphite(r Registry, interval int, addr string) {
 	for {
-		time.Sleep(time.Duration(int64(1e9) * int64(interval)))
-
 		now := time.Now().Unix()
 		conn, err := net.Dial("tcp", addr)
 		if err != nil {
 			continue
 		}
-
 		w := bufio.NewWriter(conn)
 		r.Each(func(name string, i interface{}) {
 			switch m := i.(type) {
@@ -61,5 +58,6 @@ func Graphite(r Registry, interval int, addr string) {
 			}
 			w.Flush()
 		})
+		time.Sleep(time.Duration(int64(1e9) * int64(interval)))
 	}
 }