"flag"
"fmt"
"log"
+ "net/http"
"os"
"os/signal"
"syscall"
// 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
// Print version information if requested
if *getVersion {
- fmt.Printf("Version: %s\n", version)
- os.Exit(0)
+ fmt.Printf("keep-balance %s\n", version)
+ return
}
mustReadConfig(&cfg, *configPath)
log.Fatal(config.DumpAndExit(cfg))
}
- log.Printf("keep-balance %q started", version)
+ 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 {
debugf = log.Printf