fix kernal panic
This commit is contained in:
parent
3af85db036
commit
d925847734
|
@ -90,9 +90,7 @@ func main() {
|
|||
// Set global variables.
|
||||
config.FollowSymlinks = false // TODO: make sure this works then set it based on the config yml
|
||||
|
||||
log.Infof("Elasticsearch enabled: %t", cfg.ElasticsearchEnable)
|
||||
|
||||
// Start the Elastic connection so it can initialize while we're doing the initial crawl.
|
||||
// Start the Elastic connection, so it can initialize while we're doing the initial crawl.
|
||||
// If we fail to establish a connection to Elastic, don't kill the entire server. Instead, just disable Elastic.
|
||||
if cfg.ElasticsearchEnable {
|
||||
esCfg := elasticsearch.Config{
|
||||
|
@ -108,15 +106,15 @@ func main() {
|
|||
elastic.ElasticEnabled = false
|
||||
} else {
|
||||
elastic.ElasticClient = es
|
||||
elastic.InitializeWorkers()
|
||||
// This could take a minute, so we do this in the background while we crawl.
|
||||
go func() {
|
||||
// This could take a minute, so we do this in the background while we crawl.
|
||||
elastic.EnableElasticsearchConnection()
|
||||
for cache.InitialCrawlInProgress {
|
||||
// Sleep while the initial crawl is running.
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
if !cliArgs.disableElasticSync || !cfg.ElasticsearchSyncEnable {
|
||||
elastic.InitializeWorkers()
|
||||
go elastic.SyncThread()
|
||||
log.Info("Started the background Elasticsearch sync thread.")
|
||||
} else {
|
||||
|
@ -126,6 +124,8 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
log.Infof("Elasticsearch enabled: %t", cfg.ElasticsearchEnable)
|
||||
|
||||
Workers.InitializeWorkers()
|
||||
|
||||
cache.InitRecacheSemaphore(cfg.CacheRecacheCrawlerLimit)
|
||||
|
|
|
@ -37,7 +37,6 @@ func SyncThread() {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: make this use workers instead of starting a million threads
|
||||
// TODO: have the workers exit when the sync job is finished
|
||||
func syncElasticsearch(doFullSync bool) {
|
||||
if !ElasticEnabled {
|
||||
|
|
Loading…
Reference in New Issue