From: Sebastien Douheret Date: Wed, 31 May 2017 10:24:23 +0000 (+0200) Subject: Increase timeout for Syncthing startup. X-Git-Tag: v0.0.1-alpha X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Ftags%2Fv0.0.1-alpha;p=src%2Fxds%2Fxds-agent.git Increase timeout for Syncthing startup. Syncthing may take more time to start for example on slow network connection. --- diff --git a/main.go b/main.go index 44dda71..d3722e2 100644 --- a/main.go +++ b/main.go @@ -66,12 +66,13 @@ func xdsAgent(cliCtx *cli.Context) error { // Establish connection with local Syncthing (retry if connection fail) time.Sleep(3 * time.Second) - retry := 10 + maxRetry := 30 + retry := maxRetry for retry > 0 { if err := ctx.SThg.Connect(); err == nil { break } - ctx.Log.Infof("Establishing connection to Syncthing (retry %d/10)", retry) + ctx.Log.Infof("Establishing connection to Syncthing (retry %d/%d", retry, maxRetry) time.Sleep(time.Second) retry-- }