mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-04 16:09:33 +00:00
Merge pull request #2295 from jmccann/keepalive_server
Allow setting MinTime for keepalive enforcement on server
This commit is contained in:
commit
ce740a635e
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"
|
||||||
|
@ -468,6 +469,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: "server-side enforcement policy on the minimum amount of time a client should wait before sending a keepalive ping.",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func server(c *cli.Context) error {
|
func server(c *cli.Context) error {
|
||||||
|
@ -534,6 +540,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