rename config variable
This commit is contained in:
parent
6a7153b92b
commit
56be07c0a7
|
@ -6,7 +6,7 @@ watch_mode: crawl
|
|||
crawl_mode_crawl_interval: 3600 # seconds
|
||||
watch_interval: 2 # seconds
|
||||
|
||||
directory_crawlers: 10
|
||||
directory_crawl_workers: 10
|
||||
crawl_workers: 1000
|
||||
|
||||
cache_size: 100000000
|
||||
|
|
|
@ -59,7 +59,7 @@ func APIAdminCrawlsInfo(w http.ResponseWriter, r *http.Request) {
|
|||
},
|
||||
"crawlWorkers": map[string]interface{}{
|
||||
"busy": atomic.LoadInt32(&globals.DirectoryCrawlers.BusyWorkers),
|
||||
"alive": config.GetConfig().DirectoryCrawlers,
|
||||
"alive": config.GetConfig().DirectoryCrawlWorkers,
|
||||
},
|
||||
"queue": map[string]interface{}{
|
||||
"items": globals.DirectoryCrawlers.Queue.GetQueuedJobs(),
|
||||
|
|
|
@ -13,7 +13,7 @@ type Config struct {
|
|||
RootDir string
|
||||
HTTPPort string
|
||||
CrawlModeCrawlInterval int
|
||||
DirectoryCrawlers int
|
||||
DirectoryCrawlWorkers int
|
||||
CacheSize int
|
||||
CacheTime int // TODO: does this do anything?
|
||||
CachePrintNew bool
|
||||
|
@ -58,7 +58,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
viper.SetDefault("watch_interval", 1)
|
||||
viper.SetDefault("watch_mode", "crawl")
|
||||
viper.SetDefault("crawl_mode_crawl_interval", 3600)
|
||||
viper.SetDefault("directory_crawlers", 10)
|
||||
viper.SetDefault("directory_crawl_workers", 10)
|
||||
viper.SetDefault("cache_size", 100000000)
|
||||
viper.SetDefault("cache_time", 30)
|
||||
viper.SetDefault("cache_print_new", false)
|
||||
|
@ -115,7 +115,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
RootDir: rootDir,
|
||||
HTTPPort: viper.GetString("http_port"),
|
||||
CrawlModeCrawlInterval: viper.GetInt("crawl_mode_crawl_interval"),
|
||||
DirectoryCrawlers: viper.GetInt("directory_crawlers"),
|
||||
DirectoryCrawlWorkers: viper.GetInt("directory_crawl_workers"),
|
||||
CacheSize: viper.GetInt("cache_size"),
|
||||
CacheTime: viper.GetInt("cache_time"),
|
||||
CachePrintNew: viper.GetBool("cache_print_new"),
|
||||
|
@ -153,7 +153,7 @@ func SetConfig(configFile string) (*Config, error) {
|
|||
return nil, errors.New("cache_time must be a positive number")
|
||||
}
|
||||
|
||||
if config.DirectoryCrawlers < 1 {
|
||||
if config.DirectoryCrawlWorkers < 1 {
|
||||
return nil, errors.New("crawl_mode_crawl_interval must be greater than or equal to 1")
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ func InitializeDirectoryCrawlerWorkers() *globals.DcWorkers {
|
|||
if globals.DirectoryCrawlers != nil {
|
||||
panic("DirectoryCrawlers has already been defined!")
|
||||
}
|
||||
dcWorkers := workers.InitializeWorkers(config.GetConfig().DirectoryCrawlers, directoryCrawlerWorker)
|
||||
dcWorkers := workers.InitializeWorkers(config.GetConfig().DirectoryCrawlWorkers, directoryCrawlerWorker)
|
||||
d := &globals.DcWorkers{}
|
||||
|
||||
// Copy the fields given to us by InitializeWorkers() to the global object.
|
||||
|
@ -19,7 +19,7 @@ func InitializeDirectoryCrawlerWorkers() *globals.DcWorkers {
|
|||
dcWorkers.BusyWorkers = &d.BusyWorkers
|
||||
globals.DirectoryCrawlers = d
|
||||
|
||||
log.Debugf("CRAWLERS - Started %d directory crawler workers.", config.GetConfig().DirectoryCrawlers)
|
||||
log.Debugf("CRAWLERS - Started %d directory crawler workers.", config.GetConfig().DirectoryCrawlWorkers)
|
||||
return d
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue