This commit is contained in:
Ulric Qin 2020-03-25 19:12:01 +08:00
parent 9cd97e4f5c
commit 72a333fad9
6 changed files with 12 additions and 12 deletions

View File

@ -79,7 +79,7 @@ func NodeQueryPath(query string, limit int) (nodes []Node, err error) {
func TreeSearchByPath(query string) (nodes []Node, err error) { func TreeSearchByPath(query string) (nodes []Node, err error) {
session := DB["mon"].NewSession() session := DB["mon"].NewSession()
defer session.Clone() defer session.Close()
if strings.Contains(query, " ") { if strings.Contains(query, " ") {
arr := strings.Fields(query) arr := strings.Fields(query)

View File

@ -20,7 +20,7 @@ type Team struct {
func (t *Team) Del() error { func (t *Team) Del() error {
session := DB["uic"].NewSession() session := DB["uic"].NewSession()
defer session.Clone() defer session.Close()
if err := session.Begin(); err != nil { if err := session.Begin(); err != nil {
return err return err

View File

@ -18,9 +18,9 @@ func init() {
} }
func Update() error { func Update() error {
strategys := stra.GetLogCollects() strategies := stra.GetLogCollects()
err := UpdateGlobalStrategy(strategys) err := UpdateGlobalStrategy(strategies)
if err != nil { if err != nil {
logger.Errorf("Update Strategy cache error ! [msg:%v]", err) logger.Errorf("Update Strategy cache error ! [msg:%v]", err)
return err return err

View File

@ -146,8 +146,8 @@ func DeepCopyStringMap(p map[string]string) map[string]string {
const PATTERN_EXCLUDE_PARTITION = "```EXCLUDE```" const PATTERN_EXCLUDE_PARTITION = "```EXCLUDE```"
func parsePattern(strategys []*Strategy) { func parsePattern(strategies []*Strategy) {
for _, st := range strategys { for _, st := range strategies {
patList := strings.Split(st.Pattern, PATTERN_EXCLUDE_PARTITION) patList := strings.Split(st.Pattern, PATTERN_EXCLUDE_PARTITION)
if len(patList) == 1 { if len(patList) == 1 {
@ -163,8 +163,8 @@ func parsePattern(strategys []*Strategy) {
} }
} }
func updateRegs(strategys []*Strategy) { func updateRegs(strategies []*Strategy) {
for _, st := range strategys { for _, st := range strategies {
st.TagRegs = make(map[string]*regexp.Regexp, 0) st.TagRegs = make(map[string]*regexp.Regexp, 0)
st.ParseSucc = false st.ParseSucc = false

View File

@ -20,6 +20,6 @@ func loopDetect() {
func detect() { func detect() {
ps := stra.GetProcCollects() ps := stra.GetProcCollects()
DelNoPorcCollect(ps) DelNoProcCollect(ps)
AddNewPorcCollect(ps) AddNewProcCollect(ps)
} }

View File

@ -9,7 +9,7 @@ var (
ProcsWithScheduler = make(map[string]*ProcScheduler) ProcsWithScheduler = make(map[string]*ProcScheduler)
) )
func DelNoPorcCollect(newCollect map[string]*model.ProcCollect) { func DelNoProcCollect(newCollect map[string]*model.ProcCollect) {
for currKey, currProc := range Procs { for currKey, currProc := range Procs {
newProc, ok := newCollect[currKey] newProc, ok := newCollect[currKey]
if !ok || currProc.LastUpdated != newProc.LastUpdated { if !ok || currProc.LastUpdated != newProc.LastUpdated {
@ -18,7 +18,7 @@ func DelNoPorcCollect(newCollect map[string]*model.ProcCollect) {
} }
} }
func AddNewPorcCollect(newCollect map[string]*model.ProcCollect) { func AddNewProcCollect(newCollect map[string]*model.ProcCollect) {
for target, newProc := range newCollect { for target, newProc := range newCollect {
if _, ok := Procs[target]; ok && newProc.LastUpdated == Procs[target].LastUpdated { if _, ok := Procs[target]; ok && newProc.LastUpdated == Procs[target].LastUpdated {
continue continue