adjust logging, catch rare ResponseItem panic for later
This commit is contained in:
parent
d925847734
commit
7004e3935c
|
@ -32,6 +32,12 @@ type ResponseItem struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewResponseItem(cacheItem *CacheItem.Item) *ResponseItem {
|
func NewResponseItem(cacheItem *CacheItem.Item) *ResponseItem {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Fatalf("Recovered from panic: %s - %s", r, cacheItem.Path)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
item := &ResponseItem{
|
item := &ResponseItem{
|
||||||
Path: cacheItem.Path,
|
Path: cacheItem.Path,
|
||||||
Name: cacheItem.Name,
|
Name: cacheItem.Name,
|
||||||
|
|
|
@ -27,6 +27,8 @@ func SyncThread() {
|
||||||
ticker := time.NewTicker(time.Duration(config.GetConfig().ElasticsearchSyncInterval) * time.Second)
|
ticker := time.NewTicker(time.Duration(config.GetConfig().ElasticsearchSyncInterval) * time.Second)
|
||||||
fullSyncTicker := time.NewTicker(time.Duration(config.GetConfig().ElasticsearchFullSyncInterval) * time.Second)
|
fullSyncTicker := time.NewTicker(time.Duration(config.GetConfig().ElasticsearchFullSyncInterval) * time.Second)
|
||||||
|
|
||||||
|
log.Debugf("ELASTIC - started sync timers. Refresh: %d sec. Full: %d sec.", config.GetConfig().ElasticsearchSyncInterval, config.GetConfig().ElasticsearchFullSyncInterval)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
|
Loading…
Reference in New Issue