"flag"
"fmt"
"log"
+ "net/http"
"os"
"os/signal"
"syscall"
"git.curoverse.com/arvados.git/sdk/go/arvados"
"git.curoverse.com/arvados.git/sdk/go/config"
- arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
)
+var version = "dev"
+
const defaultConfigPath = "/etc/arvados/keep-balance/keep-balance.yml"
// Config specifies site configuration, like API credentials and the
// 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", arvadosVersion.GetVersion())
- 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", arvadosVersion.GetVersion())
+ 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