cmd/proxy-to-grafana: prevent premature termination

This commit changes proxy-to-grafana to report errors while polling for
tailscaled status instead of terminating at the first sign of an error.
This allows tailscale some time to come up before the proxy decides to
give up.

Signed-off-by: Blake Mizerany <blake.mizerany@gmail.com>
pull/4442/head
Blake Mizerany 3 years ago committed by Brad Fitzpatrick
parent c8f4dfc8c0
commit 33fa43252e

@ -86,12 +86,13 @@ func main() {
for i := 0; i < 60; i++ { for i := 0; i < 60; i++ {
st, err := tailscale.Status(context.Background()) st, err := tailscale.Status(context.Background())
if err != nil { if err != nil {
log.Fatal(err) log.Printf("error retrieving tailscale status; retrying: %v", err)
} } else {
log.Printf("tailscale status: %v", st.BackendState) log.Printf("tailscale status: %v", st.BackendState)
if st.BackendState == "Running" { if st.BackendState == "Running" {
break break
} }
}
time.Sleep(time.Second) time.Sleep(time.Second)
} }

Loading…
Cancel
Save