mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 02:19:25 +00:00
added code for agent to ping central drone server
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user