fix issue in config auto reload of gcfg

This commit is contained in:
John 2019-03-22 15:08:43 +08:00
parent 9bc49c0b29
commit 1325a145d8

View File

@ -176,11 +176,11 @@ func (c *Config) getJson(file...string) *gjson.Json {
j.SetViolenceCheck(c.vc.Val())
// 添加配置文件监听,如果有任何变化,删除文件内容缓存,下一次查询会自动更新
gfsnotify.Add(filePath, func(event *gfsnotify.Event) {
c.jsons.Remove(event.Path)
c.jsons.Remove(name)
})
return j
} else {
glog.Errorfln(`[gcfg] Load config file "%s" failed: %s`, filePath, err.Error())
glog.Criticalfln(`[gcfg] Load config file "%s" failed: %s`, filePath, err.Error())
}
return nil
})