Merge pull request #55 from docker/fix-increase-handler-timeout
fix: increase handler timeout
This commit is contained in:
10
main.go
10
main.go
@@ -17,7 +17,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
handlerTimeout = 15 * time.Second
|
|
||||||
readHeaderTimeout = 1 * time.Second
|
readHeaderTimeout = 1 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,9 +28,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
certDir string
|
certDir string
|
||||||
clientCAFile string
|
clientCAFile string
|
||||||
port int
|
port int
|
||||||
|
handlerTimeoutSeconds int
|
||||||
|
|
||||||
tufRoot string
|
tufRoot string
|
||||||
tufoutputPath string
|
tufoutputPath string
|
||||||
@@ -62,6 +62,7 @@ func init() {
|
|||||||
flag.StringVar(&certDir, "cert-dir", "", "path to directory containing TLS certificates")
|
flag.StringVar(&certDir, "cert-dir", "", "path to directory containing TLS certificates")
|
||||||
flag.StringVar(&clientCAFile, "client-ca-file", "", "path to client CA certificate")
|
flag.StringVar(&clientCAFile, "client-ca-file", "", "path to client CA certificate")
|
||||||
flag.IntVar(&port, "port", defaultPort, "Port for the server to listen on")
|
flag.IntVar(&port, "port", defaultPort, "Port for the server to listen on")
|
||||||
|
flag.IntVar(&handlerTimeoutSeconds, "handler-timeout", 25, "timeout for handler in seconds")
|
||||||
|
|
||||||
flag.StringVar(&tufRoot, "tuf-root", "prod", "specify embedded tuf root [dev, staging, prod], default [prod]")
|
flag.StringVar(&tufRoot, "tuf-root", "prod", "specify embedded tuf root [dev, staging, prod], default [prod]")
|
||||||
flag.StringVar(&metadataURL, "tuf-metadata-source", defaultMetadataURL, "source (URL or repo) for TUF metadata")
|
flag.StringVar(&metadataURL, "tuf-metadata-source", defaultMetadataURL, "source (URL or repo) for TUF metadata")
|
||||||
@@ -79,6 +80,7 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
|
handlerTimeout := time.Duration(handlerTimeoutSeconds) * time.Second
|
||||||
|
|
||||||
validateHandler, err := handler.NewValidateHandler(&handler.ValidateHandlerOptions{
|
validateHandler, err := handler.NewValidateHandler(&handler.ValidateHandlerOptions{
|
||||||
TUFRoot: tufRoot,
|
TUFRoot: tufRoot,
|
||||||
|
|||||||
Reference in New Issue
Block a user