mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-02-08 15:42:36 +00:00
Update keepalive config to use DurationFlag
This commit is contained in:
parent
06fa27d937
commit
164fd0ad3f
2 changed files with 6 additions and 23 deletions
|
@ -69,26 +69,6 @@ func loop(c *cli.Context) error {
|
||||||
|
|
||||||
// grpc.Dial(target, ))
|
// grpc.Dial(target, ))
|
||||||
|
|
||||||
agentKeepalive := keepalive.ClientParameters{}
|
|
||||||
if c.String("keepalive-time") != "" {
|
|
||||||
d, err := time.ParseDuration(c.String("keepalive-time"))
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
agentKeepalive.Time = d
|
|
||||||
}
|
|
||||||
if c.String("keepalive-timeout") != "" {
|
|
||||||
d, err := time.ParseDuration(c.String("keepalive-timeout"))
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
agentKeepalive.Timeout = d
|
|
||||||
}
|
|
||||||
|
|
||||||
conn, err := grpc.Dial(
|
conn, err := grpc.Dial(
|
||||||
c.String("server"),
|
c.String("server"),
|
||||||
grpc.WithInsecure(),
|
grpc.WithInsecure(),
|
||||||
|
@ -96,7 +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(agentKeepalive),
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
|
Time: c.Duration("keepalive-time"),
|
||||||
|
Timeout: c.Duration("keepalive-timeout"),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -80,12 +80,12 @@ func main() {
|
||||||
Name: "healthcheck",
|
Name: "healthcheck",
|
||||||
Usage: "enables the healthcheck endpoint",
|
Usage: "enables the healthcheck endpoint",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.DurationFlag{
|
||||||
EnvVar: "DRONE_KEEPALIVE_TIME",
|
EnvVar: "DRONE_KEEPALIVE_TIME",
|
||||||
Name: "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",
|
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.StringFlag{
|
cli.DurationFlag{
|
||||||
EnvVar: "DRONE_KEEPALIVE_TIMEOUT",
|
EnvVar: "DRONE_KEEPALIVE_TIMEOUT",
|
||||||
Name: "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.",
|
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.",
|
||||||
|
|
Loading…
Reference in a new issue