Skip to content

Commit bfea83a

Browse files
authored
fix: alert_cur_event return unmarshal json err (#2090)
1 parent 7a2832c commit bfea83a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

models/alert_cur_event.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,12 @@ func (e *AlertCurEvent) DB2FE() error {
305305
e.CallbacksJSON = strings.Fields(e.Callbacks)
306306
e.TagsJSON = strings.Split(e.Tags, ",,")
307307
e.OriginalTagsJSON = strings.Split(e.OriginalTags, ",,")
308-
json.Unmarshal([]byte(e.Annotations), &e.AnnotationsJSON)
309-
json.Unmarshal([]byte(e.RuleConfig), &e.RuleConfigJson)
308+
if err := json.Unmarshal([]byte(e.Annotations), &e.AnnotationsJSON); err != nil {
309+
return err
310+
}
311+
if err := json.Unmarshal([]byte(e.RuleConfig), &e.RuleConfigJson); err != nil {
312+
return err
313+
}
310314
return nil
311315
}
312316

@@ -617,8 +621,8 @@ func AlertCurEventGetMap(ctx *ctx.Context, cluster string) (map[int64]map[string
617621
return ret, nil
618622
}
619623

620-
func (m *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error {
621-
return DB(ctx).Model(m).Updates(fields).Error
624+
func (e *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error {
625+
return DB(ctx).Model(e).Updates(fields).Error
622626
}
623627

624628
func AlertCurEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error {

0 commit comments

Comments
 (0)