mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 10:21:00 +00:00
Merge pull request #2294 from jmccann/keepalive
Add keepalive to agents
This commit is contained in:
commit
fc22c5b39a
2 changed files with 15 additions and 0 deletions
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
"github.com/cncd/pipeline/pipeline"
|
"github.com/cncd/pipeline/pipeline"
|
||||||
|
@ -75,6 +76,10 @@ func loop(c *cli.Context) error {
|
||||||
username: c.String("username"),
|
username: c.String("username"),
|
||||||
password: c.String("password"),
|
password: c.String("password"),
|
||||||
}),
|
}),
|
||||||
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
|
Time: c.Duration("keepalive-time"),
|
||||||
|
Timeout: c.Duration("keepalive-timeout"),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -80,6 +80,16 @@ func main() {
|
||||||
Name: "healthcheck",
|
Name: "healthcheck",
|
||||||
Usage: "enables the healthcheck endpoint",
|
Usage: "enables the healthcheck endpoint",
|
||||||
},
|
},
|
||||||
|
cli.DurationFlag{
|
||||||
|
EnvVar: "DRONE_KEEPALIVE_TIME",
|
||||||
|
Name: "keepalive-time",
|
||||||
|
Usage: "after a duration of this time if the agent doesn't see any activity it pings the server to see if the transport is still alive",
|
||||||
|
},
|
||||||
|
cli.DurationFlag{
|
||||||
|
EnvVar: "DRONE_KEEPALIVE_TIMEOUT",
|
||||||
|
Name: "keepalive-timeout",
|
||||||
|
Usage: "after having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue