X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d7db1f0877015228835fac67d4ad08789d39c520..6b8a3d3d912573ab432c319121eaffd0bbe2216b:/services/keep-balance/main.go diff --git a/services/keep-balance/main.go b/services/keep-balance/main.go index 947033564d..90235cbf31 100644 --- a/services/keep-balance/main.go +++ b/services/keep-balance/main.go @@ -9,6 +9,7 @@ import ( "flag" "fmt" "log" + "net/http" "os" "os/signal" "syscall" @@ -45,6 +46,9 @@ type Config struct { // more memory, but can reduce store-and-forward latency when // fetching pages) CollectionBuffers int + + // Timeout for outgoing http request/response cycle. + RequestTimeout arvados.Duration } // RunOptions controls runtime behavior. The flags/options that belong @@ -107,6 +111,14 @@ func main() { log.Fatal(config.DumpAndExit(cfg)) } + to := time.Duration(cfg.RequestTimeout) + if to == 0 { + to = 30 * time.Minute + } + arvados.DefaultSecureClient.Timeout = to + arvados.InsecureHTTPClient.Timeout = to + http.DefaultClient.Timeout = to + log.Printf("keep-balance %s started", version) if *debugFlag {