This commit is contained in:
shoopea 2019-05-08 19:12:30 +08:00
parent 528f13f356
commit 3dd0183efd

9
sql.go
View File

@ -279,7 +279,7 @@ func insertMsgReport(objId int64, war_date int32, atk int32, def int32, exp int3
return nil return nil
} }
func loadMsgParsingRules() (map[int]MessageParsingRule, error) { func loadMsgParsingRules() (m map[int]MessageParsingRule, err error) {
var ( var (
id int32 id int32
priority int32 priority int32
@ -289,13 +289,12 @@ func loadMsgParsingRules() (map[int]MessageParsingRule, error) {
) )
log.Println("Loading message parsing rules...") log.Println("Loading message parsing rules...")
m := make(map[int]MessageParsingRule) m = make(map[int]MessageParsingRule)
count := int(0) count := int(0)
defer func() { defer func() {
if rec := recover(); rec != nil { if rec := recover(); rec != nil {
log.Printf("loadMsgParsingRules : panic %s \n", rec) err := errors.New(rec)
return
} }
}() }()
@ -316,10 +315,8 @@ func loadMsgParsingRules() (map[int]MessageParsingRule, error) {
i.Description = descn i.Description = descn
i.Rule = rule i.Rule = rule
i.MsgTypeID = msgTypeID i.MsgTypeID = msgTypeID
i.re = regexp.MustCompile(rule)
m[count] = *i m[count] = *i
count++ count++
} }
return m, nil return m, nil