minor cleanup
This commit is contained in:
parent
631844fb98
commit
cd4364436a
|
@ -30,8 +30,8 @@ func AdminCacheInfo(w http.ResponseWriter, r *http.Request) {
|
|||
"cachedItems": cacheLen,
|
||||
"cacheMax": config.GetConfig().CacheSize,
|
||||
"recacheCrawlLimit": config.GetConfig().CacheRecacheCrawlerLimit,
|
||||
"newSyncRunning": elastic.ElasticRefreshSyncRunning,
|
||||
"refreshSyncRunning": elastic.ElasticRefreshSyncRunning,
|
||||
"newSyncRunning": elastic.FullSyncRunning,
|
||||
"refreshSyncRunning": elastic.FullSyncRunning,
|
||||
}
|
||||
w.Header().Set("Cache-Control", "no-store")
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
|
|
@ -57,7 +57,7 @@ func logCacheStatus(msg string, ticker *time.Ticker, logFn func(format string, a
|
|||
logFn(logStr,
|
||||
msg, len(SharedCache.Cache.Keys()), config.GetConfig().CacheSize, Workers.BusyWorkers, Workers.Queue.GetQueueSize(), DirectoryCrawler.GetTotalActiveCrawls())
|
||||
} else {
|
||||
logStr := "%s - %d/%d items in the cache. Busy Workers: %d. Jobs queued: %d. Running crawls: %d. Busy Elastic sync workers: %d. Elastic sync queued: %d"
|
||||
logStr := "%s - %d/%d items in the cache. Busy Workers: %d. Jobs queued: %d. Running crawls: %d. Busy Elastic delete workers: %d. Elastic deletes queued: %d"
|
||||
logFn(logStr,
|
||||
msg, len(SharedCache.Cache.Keys()), config.GetConfig().CacheSize, Workers.BusyWorkers, Workers.Queue.GetQueueSize(), DirectoryCrawler.GetTotalActiveCrawls(), elastic.BusyWorkers, elastic.Queue.GetQueueSize())
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ func worker() {
|
|||
atomic.AddInt32(&BusyWorkers, 1)
|
||||
|
||||
if _, ok := SharedCache.Cache.Get(job.Key); !ok {
|
||||
// If a key does not exist in the LRU cache, delete it from Elasticsearch
|
||||
// If a key in Elastic does not exist in the LRU cache, delete it from Elastic.
|
||||
deleteFromElasticsearch(job.Key)
|
||||
log.Debugf(`ELASTIC - Removed key "%s"`, job.Key)
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@ func syncElasticsearch(doFullSync bool) {
|
|||
|
||||
var syncType string
|
||||
if fullSync {
|
||||
ElasticRefreshSyncRunning = true
|
||||
FullSyncRunning = true
|
||||
syncType = "full refresh"
|
||||
} else {
|
||||
ElasticNewSyncRunning = true
|
||||
RefreshSyncRunning = true
|
||||
syncType = "refresh"
|
||||
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ func syncElasticsearch(doFullSync bool) {
|
|||
|
||||
duration := time.Since(start)
|
||||
log.Infof("ELASTIC - %s sync finished in %s", syncType, duration)
|
||||
FullSyncRunning = false
|
||||
RefreshSyncRunning = false
|
||||
syncLock.Unlock()
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ import (
|
|||
var log *logrus.Logger
|
||||
var ElasticClient *elasticsearch.Client
|
||||
|
||||
var ElasticNewSyncRunning bool
|
||||
var ElasticRefreshSyncRunning bool
|
||||
var RefreshSyncRunning bool
|
||||
var FullSyncRunning bool
|
||||
|
||||
func init() {
|
||||
log = logging.GetLogger()
|
||||
ElasticNewSyncRunning = false
|
||||
ElasticRefreshSyncRunning = false
|
||||
RefreshSyncRunning = false
|
||||
FullSyncRunning = false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue