diff options
author | Alan Pearce | 2024-05-09 18:41:05 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-09 19:27:57 +0200 |
commit | 1db7c2a1630c3d80c3c696c8fabaa5476eb2184e (patch) | |
tree | d20ae225d973021b3cbd4ebf7e3b8ee86edf626d /import/main.go | |
parent | 778e1d774f574f45c179d0fecf0c1da9cc359b80 (diff) | |
download | searchix-1db7c2a1630c3d80c3c696c8fabaa5476eb2184e.tar.lz searchix-1db7c2a1630c3d80c3c696c8fabaa5476eb2184e.tar.zst searchix-1db7c2a1630c3d80c3c696c8fabaa5476eb2184e.zip |
feat(importer): make timeout configurable via command-line
Diffstat (limited to 'import/main.go')
-rw-r--r-- | import/main.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/import/main.go b/import/main.go index 52b4515..90f2b74 100644 --- a/import/main.go +++ b/import/main.go @@ -17,12 +17,11 @@ import ( "github.com/ardanlabs/conf/v3" ) -const timeout = 30 * time.Minute - type Config struct { - ConfigFile string `conf:"short:c"` - LogLevel slog.Level `conf:"default:INFO"` - Replace bool `conf:"default:false,help:whether to remove existing database, if exists"` + ConfigFile string `conf:"short:c"` + LogLevel slog.Level `conf:"default:INFO"` + Timeout time.Duration `conf:"default:30m,help:maximum time to wait for all fetchers and importers combined"` + Replace bool `conf:"default:false,help:whether to remove existing database, if exists"` } func main() { @@ -56,7 +55,7 @@ func main() { log.Fatalf("Failed to create indexer: %v", err) } - ctx, cancel := context.WithTimeout(context.Background(), timeout) + ctx, cancel := context.WithTimeout(context.Background(), runtimeConfig.Timeout) defer cancel() var imp importer.Importer |