Fix crawl descent

This commit is contained in:
Richard Patel
2018-10-28 03:06:18 +01:00
parent a507110787
commit 1c33346f45
5 changed files with 31 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ var config struct {
Retries int
Workers int
StatsInterval time.Duration
Verbose bool
}
const (
@@ -20,12 +21,14 @@ const (
ConfRetries = "retries"
ConfWorkers = "workers"
ConfStatsInterval = "stats_interval"
ConfVerbose = "verbose"
)
func prepareConfig() {
viper.SetDefault(ConfRetries, 3)
viper.SetDefault(ConfWorkers, 50)
viper.SetDefault(ConfStatsInterval, 3 * time.Second)
viper.SetDefault(ConfVerbose, false)
}
func readConfig() {
@@ -57,4 +60,9 @@ func readConfig() {
}
config.StatsInterval = viper.GetDuration(ConfStatsInterval)
config.Verbose = viper.GetBool(ConfVerbose)
if config.Verbose {
logrus.SetLevel(logrus.DebugLevel)
}
}