clear cached elastic data when sync is done, bug fix
This commit is contained in:
parent
9a450571bd
commit
3f305b104b
|
@ -85,7 +85,7 @@ func syncElasticsearch(doFullSync bool) {
|
||||||
return
|
return
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
logStr := "ELASTIC - Sync in progress. Elapsed: %d. Busy Elastic delete workers: %d. Elastic deletes queued: %d"
|
logStr := "ELASTIC - Sync in progress. Elapsed: %s. Busy Elastic delete workers: %d. Elastic deletes queued: %d"
|
||||||
log.Debugf(logStr, elapsed, globals.ElasticCrawlers.BusyWorkers, globals.ElasticCrawlers.Queue.GetQueueSize())
|
log.Debugf(logStr, elapsed, globals.ElasticCrawlers.BusyWorkers, globals.ElasticCrawlers.Queue.GetQueueSize())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,12 @@ func syncElasticsearch(doFullSync bool) {
|
||||||
globals.ElasticCrawlers.Queue.Terminate()
|
globals.ElasticCrawlers.Queue.Terminate()
|
||||||
aliveWorkers.Wait()
|
aliveWorkers.Wait()
|
||||||
globals.ElasticCrawlers = nil
|
globals.ElasticCrawlers = nil
|
||||||
|
globalPathsByKeyMutex.Lock()
|
||||||
|
globalKeysByPathMutex.Lock()
|
||||||
|
globalKeysByPath = nil
|
||||||
|
globalPathsByKey = nil
|
||||||
|
globalPathsByKeyMutex.Unlock()
|
||||||
|
globalKeysByPathMutex.Unlock()
|
||||||
|
|
||||||
duration := time.Since(start)
|
duration := time.Since(start)
|
||||||
log.Infof("ELASTIC - %s sync finished in %s", syncType, duration)
|
log.Infof("ELASTIC - %s sync finished in %s", syncType, duration)
|
||||||
|
|
Loading…
Reference in New Issue