added code for agent to ping central drone server

This commit is contained in:
Brad Rydzewski
2016-05-11 14:37:56 -07:00
parent 2e709fb6a9
commit 752ce496d5
13 changed files with 347 additions and 3 deletions

View File

@@ -75,6 +75,12 @@ var AgentCmd = cli.Command{
Usage: "drone server backoff interval",
Value: time.Second * 15,
},
cli.DurationFlag{
EnvVar: "DRONE_PING",
Name: "ping",
Usage: "drone server ping frequency",
Value: time.Minute * 5,
},
cli.BoolFlag{
EnvVar: "DRONE_DEBUG",
Name: "debug",
@@ -134,6 +140,15 @@ func start(c *cli.Context) {
logrus.Fatal(err)
}
go func() {
for {
if err := client.Ping(); err != nil {
logrus.Warnf("unable to ping the server. %s", err.Error())
}
time.Sleep(c.Duration("ping"))
}
}()
var wg sync.WaitGroup
for i := 0; i < c.Int("docker-max-procs"); i++ {
wg.Add(1)