Allow setting MinTime for keepalive enforcement on server
This allows setting agent keepalive Time at value < 5m
This commit is contained in:
parent
fc22c5b39a
commit
6eb9af01c6
1 changed files with 9 additions and 0 deletions
|
@ -13,6 +13,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"
|
||||||
|
|
||||||
"golang.org/x/crypto/acme/autocert"
|
"golang.org/x/crypto/acme/autocert"
|
||||||
|
@ -461,6 +462,11 @@ var flags = []cli.Flag{
|
||||||
Name: "coding-skip-verify",
|
Name: "coding-skip-verify",
|
||||||
Usage: "coding skip ssl verification",
|
Usage: "coding skip ssl verification",
|
||||||
},
|
},
|
||||||
|
cli.DurationFlag{
|
||||||
|
EnvVar: "DRONE_KEEPALIVE_MIN_TIME",
|
||||||
|
Name: "keepalive-min-time",
|
||||||
|
Usage: "coding skip ssl verification",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func server(c *cli.Context) error {
|
func server(c *cli.Context) error {
|
||||||
|
@ -527,6 +533,9 @@ func server(c *cli.Context) error {
|
||||||
s := grpc.NewServer(
|
s := grpc.NewServer(
|
||||||
grpc.StreamInterceptor(auther.streamInterceptor),
|
grpc.StreamInterceptor(auther.streamInterceptor),
|
||||||
grpc.UnaryInterceptor(auther.unaryIntercaptor),
|
grpc.UnaryInterceptor(auther.unaryIntercaptor),
|
||||||
|
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||||
|
MinTime: c.Duration("keepalive-min-time"),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
ss := new(droneserver.DroneServer)
|
ss := new(droneserver.DroneServer)
|
||||||
ss.Queue = droneserver.Config.Services.Queue
|
ss.Queue = droneserver.Config.Services.Queue
|
||||||
|
|
Loading…
Reference in a new issue