X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/644f5de63e2b8b02e054fcbb3e9af39560cffae3..be0cdc7814a49fa093b86b698a9756971ba80fcf:/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 {